Configure FlutterGen for Dart Pub Workspaces
mainFlutterGen supports dart pub workspaces. To use it, run build_runner from the workspace root. Ensure each workspace member that requires generation has resolution: workspace in its pubspec.yaml.
Workspace Root Configuration:
environment:
sdk: ^3.7.0
workspace:
- packages/appMember Package Configuration (packages/app/pubspec.yaml):
name: app
resolution: workspace
dev_dependencies:
flutter_gen_runner:
build_runner: ^2.12.0Execution:
Run the build from the root using the --workspace flag:
dart run build_runner build --workspaceNote: If you manually removed generated files while .dart_tool/build still exists, run dart run build_runner clean from the workspace root before rebuilding to ensure a reliable incremental build.