Hook-driven Mason bricks and shared generation logic for Grumpy projects.
unitmoduleservicedatasourceguardmiddlewarescreencomponentrepositorymodel
Install Mason CLI if needed:
dart pub global activate mason_cliTo use the bricks from this repository, create a mason.yaml with the following contents:
bricks:
unit:
git:
url: https://github.com/necodeIT/grumpy_bricks
path: bricks/grumpy_unit
module:
git:
url: https://github.com/necodeIT/grumpy_bricks
path: bricks/grumpy_module
service:
git:
url: https://github.com/necodeIT/grumpy_bricks
path: bricks/grumpy_service
datasource:
git:
url: https://github.com/necodeIT/grumpy_bricks
path: bricks/grumpy_datasource
guard:
git:
url: https://github.com/necodeIT/grumpy_bricks
path: bricks/grumpy_guard
middleware:
git:
url: https://github.com/necodeIT/grumpy_bricks
path: bricks/grumpy_middleware
screen:
git:
url: https://github.com/necodeIT/grumpy_bricks
path: bricks/grumpy_screen
component:
git:
url: https://github.com/necodeIT/grumpy_bricks
path: bricks/grumpy_component
repository:
git:
url: https://github.com/necodeIT/grumpy_bricks
path: bricks/grumpy_repository
model:
git:
url: https://github.com/necodeIT/grumpy_bricks
path: bricks/grumpy_modelThen fetch the bricks:
mason getEach brick is pulled from the GitHub repository and resolved from its directory within the repo.
Generate a brick by name and pass the required name variable:
mason make screen --name loginAll bricks use the shared Grumpy generation hooks included in this repository.
Generation defaults can be applied globally, per unit kind, and per subtype.
defaults:
all:
imports:
- import 'package:collection/collection.dart';
mixins: []
model:
imports: []
mixins: []
extends_model: true
fields: {}
component:
imports: []
mixins: []
query_component:
imports: []
mixins:
- StatefulQueryLoader
- StatefulQueryError
query_result_type: auto
repository:
imports: []
mixins: []
repo_mixins: []
discovery:
prefer_project_types: true
infer_config_type: true
infer_query_component_repo: true
infer_query_component_result_type: true
infer_repository_query_item_type: true
prefer_existing_directories: trueNotes:
defaults.allapplies to every generated file.defaults.<unit>applies to the full unit kind such asmodelorrepository.defaults.<subtype>applies to subtypes such asquery_component.importsandmixinsare merged in this order: built-in defaults,all, unit, subtype, explicit vars.- Models default to
fields: {}and no implicitidfield is generated. - The full field-level reference lives in grumpy_context/grumpy.schema.json.
Query components no longer ask for a type by default. They generate a typedef based on the base name:
typedef UserProfileQueryResult = void;
class UserProfileComponent extends QueryComponent<UserProfileQueryResult> {
const UserProfileComponent({super.key});
@override
Future<UserProfileQueryResult> query(QueryHooks use) async {}
}When you generate a query component interactively, the query-mixin dialog now shows one combined list with source labels, for example:
StatefulQueryLoader [framework: grumpy_flutter]DefaultErrorBuilder [project: lib/src/app/utils/query_component_utils.dart]SomeConfiguredMixin [config: defaults.query_component.mixins]