22

Mason Templates

A library that contains multiple templates for dart and flutter code generation.

Freezed cubit 🧊

Generates a new freezed cubit, and its runner files in Dart. Built for the flutter bloc state management library with freezed.

Usage πŸš€

Make sure that freezed, freezed_annotation, flutter_bloc, and build_runner are added to your pubspec.yaml.

mason make freezed_cubit

Variables ✨

| Variable | Description | Default | Type | | -------- | -------------------------- | --------- | -------- | | name | The name of the cubit class | counter | string | | generate_status | Whether to generate a status class for the cubit | true | boolean | | path_for_test | The path for creating a test file for the cubit; won't generate if the value is empty | | string |

Output πŸ“¦

β”œβ”€β”€ counter_cubit.dart
└── counter_state.dart
β”œβ”€β”€ counter_cubit_test.dart

Freezed cubit test🧊

Generates a new freezed cubit test at the given path. Built for the freezed_cubit template.

Usage πŸš€

Make sure that bloc_test and flutter_test are added to your pubspec.yaml.

mason make freezed_cubit_test

Variables ✨

| Variable | Description | Default | Type | | -------- | -------------------------- | --------- | -------- | | path | The path where the test should be created | | string | | name | The name of the cubit class | counter | string |

Output πŸ“¦

β”œβ”€β”€ counter_cubit_test.dart