Dart by Example: Pub

Pub is the package manager for Dart.

A typical package has this file structure:

1. cool_package/
2. bin/
3. ice
4. lib/
5. sodas.dart
6. src/
7. pepsi.dart
8. coke.dart
9. example/
10. soda_example.dart
11. web/
12. cool_app.dart
13. index.html
14. style.css
15. pubspec.yaml
16. README.md
1. # pubspec.yaml

3. name: cool_package # use separate package names with underscores
4. version: 1.2.3 # use semver
5. description: >
6. A really cool package that allows you to
7. reticulate your splines and transmogrify
8. your unidirectional dataflow.
9. author: John Ryan
10. homepage: johnpryan.github.io
11. environment:
12. sdk: ">=0.12.0"
13. documentation: http://docs.coolpackagedartlang.com
14. dependencies:
15. yaml: ^2.1.0
16. frappe: ^0.4.0
17. dev_dependencies:
18. test: ^0.12.0
19. dependency_overrides:
20. stream_transformers: 0.2.0
21. yaml:
22. path: ../yaml

dependency_overrides force all packagesin the dependency graph to use a specific version(since only one version of a package is allowed.)

path: dependencies are convenient if multiple packages are being developed on a local machine.

For details, see pub package layout conventions.

by @jryanio | source | license