A template generator which helps teams generate files quickly and consistently. It can be helpful for developers who find themselves writing the same code over and over again.
In simple term, You can create your own folder structure and files for your project and use it globally in all your projects.
This project contains cubit template which write your boilerplate code for cubit.
Run this command
1.Global Installation
dart pub global activate mason_cli
2.Local Installation (With dart)
dart pub add mason_cli
(With flutter)
flutter pub add mason_cli
Run this command in your project terminal
$ mason init
This command will initialize mason in your current directory. It will generate a mason.yaml along with a .mason directory.
Add these packages in pubspec.yaml before you use this template.
flutter_bloc: ^8.1.2
equatable: ^2.0.5
The folder structure are as follows
feature
|- cubit
| |- feature_cubit.dart
| |- feature_state.dart
|- screen
| |- feature_screen.dart
|- widgets
| |- feature_widget.dart
The real structure will look like this…
Run this command to add cubit template
$ mason add cubit_brick --git-url https://github.com/flutterflytech/mason_templates --git-path bricks/cubit_brick
this will add cubit_brick in project & you can see in mason.yaml
Run this command to make a new template
$ mason make cubit_brick