Manage Flutter and Dart Monorepos with Melos
Set up Dart Pub workspaces and Melos for local package resolution, scoped scripts, and predictable verification across dependent Flutter packages.
Identify repository boundaries, Dart and Flutter SDK versions, and packages that release independently. Read root and package manifests. Draw the edges from the application to internal packages so the workspace configuration can be checked against the intended design. For example, a Flutter app and a shared pure-Dart library may resolve together while still requiring different test runners. ## Key Points - [Melos getting started](https://melos.invertase.dev/getting-started) - [Melos bootstrap](https://melos.invertase.dev/commands/bootstrap) - [Dart Pub workspaces](https://dart.dev/tools/pub/workspaces)
skilldb get flutter-skills/melos-monorepo-workspacesFull skill: 29 linesManage Flutter and Dart Monorepos with Melos
Map packages before configuring commands
Identify repository boundaries, Dart and Flutter SDK versions, and packages that release independently. Read root and package manifests. Draw the edges from the application to internal packages so the workspace configuration can be checked against the intended design. For example, a Flutter app and a shared pure-Dart library may resolve together while still requiring different test runners.
Check the pinned Melos major. Recent Melos versions build on Dart Pub workspaces and use root manifest configuration, while older layouts can use a separate Melos configuration file. Confirm the documented layout before migrating. In a Pub workspace, declare member paths at the root and use resolution: workspace in members according to the SDK requirements. Keep each local dependency's version constraint compatible with the member package's declared version. A local member cannot fix a constraint that rejects its version.
Run dart pub workspace list from the root and confirm membership before bootstrapping. Prefer explicit package paths when repository structure is still changing. If the project uses workspace globs, check SDK support and verify that a sample app, test fixture, or generated package has not been included by accident. Resolve once at the root and confirm the shared lockfile and package configuration are the ones consumed by builds. Investigate stale nested resolution files during migration before relying on output from a local machine.
Make script scope observable
Use the project's pinned Melos invocation in local development and CI. Read any bootstrap hooks and shared dependency configuration before running them. If hooks generate files or synchronize dependency constraints, review and record those effects with the repository's usual diff checks. Run package discovery, then a small leaf package check, then one check that covers the app and its shared library.
Separate scripts by runtime where it matters. A pure-Dart package may use the Dart runner while a Flutter package needs Flutter tooling. Keep package filters explicit and log the selected packages before each command. Use a documented filter for changed packages only when the base revision is known and the runner can also include the required reverse dependencies. A changed shared package can break an app whose own files never changed. If a filter returns no packages unexpectedly, fail the verification or record why the empty set is expected.
For release checks, map package version updates in dependency order, inspect lockfile and changelog diffs, and validate a clean checkout against the same SDK and Melos versions used in CI. Record the package list, resolution outcome, commands, and test output. A successful bootstrap alone confirms package setup and hooks. The consumer tests establish that the selected packages can work together.
References
Install this skill directly: skilldb add flutter-skills
Related Skills
Navigation
GoRouter navigation patterns for declarative, deep-linkable Flutter routing
Networking
Dio HTTP client and API integration patterns for Flutter applications
Platform Channels
Platform channels for bridging Flutter with native Android (Kotlin) and iOS (Swift) code
State Management
Riverpod and Bloc state management patterns for scalable Flutter applications
Testing
Widget testing, unit testing, and integration testing patterns for Flutter apps
Widgets
Widget composition patterns for building reusable, performant Flutter UIs