dart-package-management
Managing Dart Packages
Contents
Package Layout Conventions
Structure Dart packages using standardized directories to ensure tooling compatibility and clear API boundaries.
lib/: Place public libraries and assets here. Export only the public API surface.lib/src/: Place internal implementation files here. Never import from another package'slib/src/. Use relative imports within your own package when importing fromlib/src/tolib/.bin/: Place public command-line executables here.tool/: Place internal scripts and tools (e.g., code generation, documentation scripts) here.test/: Place unit tests here, suffixed with_test.dart.integration_test/: Place slow, integration-level tests here.example/: Place standalone example programs demonstrating package usage. Usepackage:imports to reference the parent package.
More from dart-lang/skills
dart-add-unit-test
Write and organize unit tests for functions, methods, and classes using `package:test`. Use when creating new logic or fixing bugs to ensure code remains correct and regression-free.
2.0Kdart-fix-runtime-errors
Uses get_runtime_errors and lsp to fetch an active stack trace, locate the failing line, apply a fix, and verify resolution via hot_reload.
2.0Kdart-run-static-analysis
Execute `dart analyze` to identify warnings and errors, and use `dart fix --apply` to automatically resolve mechanical lint issues. Use during development to ensure code quality and before committing changes.
2.0Kdart-use-pattern-matching
Use switch expressions and pattern matching where appropriate
2.0Kdart-resolve-package-conflicts
Workflow for fixing package version conflicts. Use this when `pub get` fails due to incompatible package versions.
2.0Kdart-collect-coverage
Collect coverage using the coverage packge and create an LCOV report
2.0K