Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

Style guide should specify what should be exported by a library #1349

Closed
donny-dont opened this issue May 12, 2015 · 6 comments
Closed

Style guide should specify what should be exported by a library #1349

donny-dont opened this issue May 12, 2015 · 6 comments

Comments

@donny-dont
Copy link

Its not clear from the style guide what is acceptable to export by a library.

As a contrived example lets say I have a package foo that uses a package bar.

// lib/foo.dart
import 'package:bar/bar.dart';

class Foo {
  void doBar(Bar bar);
}

If a client of Foo is likely to use doBar its not clear if there should be an `export 'package:bar/bar.dart' in foo.dart, or if the library consumer should assume that if they want to use the method that they will then need to add bar to their pubspec and import it separately.

@munificent
Copy link
Contributor

This is probably a bit out of scope for the style guide, but I agree it would be useful to document somewhere.

(And, in this case, the answer is no, you don't generally need to export a library just because a type from it is in your public API.)

@donny-dont
Copy link
Author

Yea just wasn't sure what the logic is for exporting other libraries that are outside your package. It seemed like in general it was a don't export anything outside your jurisdiction but there's no docs with guidelines anywhere.

@kwalrath
Copy link
Contributor

Lasse, Florian, Natalie, Bob... they have this kind of knowledge. It'd be good to have a library design guide of some sort.

@donny-dont
Copy link
Author

Article would be great too.

@nex3
Copy link
Contributor

nex3 commented Jun 24, 2015

(And, in this case, the answer is no, you don't generally need to export a library just because a type from it is in your public API.)

This is true except when the library is in your package. You should make sure that any types defined in package-private libraries but used in your public API are exported as part of that public API.

@kwalrath
Copy link
Contributor

This issue was moved to dart-lang/site-www#67

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

5 participants