https://github.com/cosee/mason_blog
Demonstrage how to use mason to generate a BLoC in Dart.
https://github.com/cosee/mason_blog
bloc dart mason
Last synced: 5 months ago
JSON representation
Demonstrage how to use mason to generate a BLoC in Dart.
- Host: GitHub
- URL: https://github.com/cosee/mason_blog
- Owner: cosee
- License: bsd-3-clause
- Created: 2024-02-13T06:58:27.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-13T08:15:46.000Z (over 2 years ago)
- Last Synced: 2024-05-03T03:27:46.604Z (about 2 years ago)
- Topics: bloc, dart, mason
- Language: Dart
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Generates a new Bloc in [Dart](https://dart.dev). Built for
the [bloc state management library](https://github.com/felangel/bloc).
## Prerequisite 🛠
### Mason setup
To get started, install [mason](https://pub.dev/packages/mason) using one of the following methods:
```sh
# 🎯 Activate from https://pub.dev
dart pub global activate mason_cli
# 🍺 Or install from https://brew.sh
brew tap felangel/mason
brew install mason
```
### Flutter setup
We recommend using [asdf](https://asdf-vm.com/) as a version manager. Follow these steps to set up:
1. Install [asdf](https://asdf-vm.com/guide/getting-started.html).
2. Use the Flutter version specified in [.tool-versions](.tool-versions) by running this command:
```sh
asdf install
````
3. Ensure sure you have [flutter_bloc](https://pub.dev/packages/flutter_bloc) installed:
```sh
flutter pub add flutter_bloc
```
## Usage 🚀
Register the brick with the following command:
```sh
mason add bloc --path bricks/bloc
```
Now you can utilize the brick with:
```sh
mason make bloc
```
## Variables ✨
| Variable | Description | Default | Type |
|----------|----------------------------|---------|----------|
| `name` | The name of the BLoC class | `Test` | `string` |
## Output 📦
```
└── test
├── bloc.dart
├── event.dart
└── state.dart
```