A Mason brick for a production-ready Flutter app foundation aligned with Flutter 3.44.0 and Dart 3.12.0.
- Flutter 3.44.0 baseline - SDK constraints and package versions are aligned with Dart
3.12.0. - State management -
flutter_bloc,hydrated_bloc, andbloc_concurrency. - Persistence - Hive CE via
hive_ceandhive_ce_flutter; the oldhive_flutterpackage is no longer used. - Routing - AutoRoute with generated route definitions.
- Dependency injection - GetIt and Injectable modules.
- Networking - Dio module, Retrofit client foundation, and Dio exception mapping to app exception types.
- OpenAPI/Swagger generation -
openapi_retrofit_generatorconfig and starterapi/openapi.yamlfor generated Dio/Retrofit clients. - Localization - Flutter gen-l10n with ARB files.
- Linting -
flutter_lintsplus the current official Dart recommended rules,directives_ordering, and a post-generation import sorter. - Testing foundation -
bloc_test,mocktail, and Alchemist golden test setup with starter Bloc, golden, and network mapper tests. - Asset tooling - Flutter Gen for type-safe generated assets and
SvgGenImageExtensionhelpers.
| Tool | Version |
|---|---|
| Flutter SDK | 3.44.0 or newer |
| Dart SDK | 3.12.0 or newer |
| Mason CLI | 0.1.3 or newer |
Flutter 3.44.0 ships with Dart 3.12.0.
The brick creates a Flutter app with:
lib/core/app.dartandlib/core/app_setup.dartfor app bootstrap.lib/core/network/for Dio, Retrofit, and network exception handling.lib/core/extensions/svg_gen_image_extension.dartfor generated SVG color helpers.api/openapi.yamlandopenapi_generator.yamlfor OpenAPI/Swagger client generation.lib/features/home/andlib/features/language_settings/as starter feature examples.test/helpers and examples for Bloc tests and Alchemist golden tests.- A Mason
post_genhook that sorts Dart imports afterpackageNameinterpolation sodirectives_orderingworks for generated apps.
| Package | Version |
|---|---|
auto_route |
^11.1.0 |
dio |
^5.9.2 |
flutter_bloc |
^9.1.1 |
get_it |
^9.2.1 |
hive_ce |
^2.19.3 |
hive_ce_flutter |
^2.3.4 |
hydrated_bloc |
^11.0.0 |
injectable |
^3.0.0 |
retrofit |
^4.9.2 |
| Package | Version |
|---|---|
alchemist |
^0.14.0 |
auto_route_generator |
^10.5.0 |
bloc_test |
^10.0.0 |
build_runner |
^2.15.0 |
flutter_gen_runner |
^5.14.1 |
hive_ce_generator |
^1.11.1 |
injectable_generator |
^3.0.2 |
json_serializable |
^6.14.0 |
mocktail |
^1.0.5 |
openapi_retrofit_generator |
^2.0.4 |
retrofit_generator |
^10.2.6 |
The package named
swagger_generatoris intentionally not included because its latest published version still declares a Dart SDK constraint below Dart 3. The brick usesopenapi_retrofit_generator, which supports Swagger/OpenAPI specs and generates Retrofit/Dio clients for current Flutter.
Install Mason if needed:
dart pub global activate mason_cliFor a new app, create the Flutter platform shell first:
flutter create my_app --project-name my_app
cd my_appInitialize Mason and add the brick:
mason init
mason add creevek_flutter_project_core --git-url https://github.com/CreevekCZ/creevek_flutter_project_coreGenerate the app foundation over the Flutter shell:
mason make creevek_flutter_project_core --on-conflict overwriteInstall dependencies:
flutter pub getGenerate OpenAPI and Dart code:
dart run openapi_retrofit_generator
dart run build_runner buildRun tests:
flutter test
flutter test --update-goldensRun the app:
flutter runIf you generate the brick into an empty directory instead of a Flutter-created
project, flutter test, flutter analyze, and code generation still work after
flutter pub get, but flutter run needs platform folders from flutter create.
The generated project includes a ready Injectable NetworkModule that registers:
Diowith base URL, JSON headers, timeouts, and debug logging.AppApiClient, a starter Retrofit client.
For Swagger/OpenAPI-driven clients, edit api/openapi.yaml, then run:
dart run openapi_retrofit_generator
dart run build_runner buildGenerated clients are written to lib/api.
The generated app includes:
test/helpers/hydrated_bloc_storage.dartfor HydratedBloc storage stubbing with Mocktail.test/flutter_test_config.dartfor global Alchemist config.- A starter
LanguageCubitBloc test. - A starter CI-only
HomeScreenAlchemist golden test with an initial baseline. - A starter Dio exception mapper unit test.
This project is licensed under the MIT License. See LICENSE for details.