Speed Up Your Flutter Development with Mason | by Divyanshu Bhargava | Mar, 2022

# 🎯 Activate from https://pub.dev
dart pub international activate mason_cli
# 🍺 Or set up from https://brew.sh
brew faucet felangel/mason
brew set up mason
mason init
# Register bricks that may be consumed through the Mason CLI.
# https://github.com/felangel/mason
# Pattern Brick
# Run `mason make hiya` to attempt it out.
hiya: 0.1.0+1
# Bricks can be imported through git url.
# Uncomment the next strains to import
# a brick from a distant git url.
# widget:
# git:
# url: https://github.com/felangel/mason.git
# path: bricks/widget
mason new cubit -d "A brand new cubit template"
✓ Created new brick: cubit (0.0s)
✓ Generated 5 file(s):
/Customers/divyanshubhargava/bricks/cubit/brick.yaml (new)
/Customers/divyanshubhargava/bricks/cubit/README.md (new)
/Customers/divyanshubhargava/bricks/cubit/CHANGELOG.md (new)
/Customers/divyanshubhargava/bricks/cubit/LICENSE (new)
/Customers/divyanshubhargava/bricks/cubit/__brick__/HELLO.md (new)
  1. __brick__ listing: All of your template information are added to this Listing.
  2. bricks.yaml: A metadata file on your brick template.
identify: cubit
description: A brand new cubit template
# The next defines the model and construct quantity on your brick.
# A model quantity is three numbers separated by dots, like 1.2.34
# adopted by an optionally available construct quantity (separated by a +).
model: 0.1.0+1
# The next defines the setting for the present brick.
# It contains the model of mason that the brick requires.
mason: ">=0.1.0-dev <0.1.0"
# Variables specify dynamic values that your brick relies on.
# Zero or extra variables will be specified for a given brick.
# Every variable has:
# * a sort (string, quantity, or boolean)
# * an optionally available quick description
# * an optionally available default worth
# * an optionally available immediate phrase used when asking for the variable.
sort: string
description: Cubit identify
default: Sprint
immediate: What is the cubit identify?
| |--cubit
| | |--#snakeCasename/snakeCase
| |--cubit
| | |--#snakeCasename/snakeCase
a part of '#snakeCasename_cubit/snakeCase.dart';class #pascalCasenameState/pascalCase extends Equatable 
const #pascalCasenameState/pascalCase();
Record<Object?> get props => [];
import 'bundle:equatable/equatable.dart';
import 'bundle:flutter_bloc/flutter_bloc.dart';
half '#snakeCasename_state/snakeCase.dart';class #pascalCasenameCubit/pascalCase extends Cubit<#pascalCasenameState/pascalCase>
#pascalCasenameCubit/pascalCase() : tremendous(const #pascalCasenameState/pascalCase());
import 'bundle:bloc_test/bloc_test.dart';
import 'bundle:mason_demo/cubit/#snakeCasename/snakeCase/#snakeCasename_cubit/snakeCase.dart';
void foremost()
'emits [] when nothing is added',
construct: () => #pascalCasenameCubit/pascalCase(),
count on: () => [],
path: bricks/cubit
mason make cubit? What is the cubit identify? (Sprint) Auth
✓ Made brick cubit (0.1s)
✓ Generated 3 file(s):
/Customers/divyanshubhargava/StudioProjects/mason_demo/take a look at/cubit/auth/auth_cubit_test.dart (equivalent)
/Customers/divyanshubhargava/StudioProjects/mason_demo/lib/cubit/auth/auth_cubit.dart (new)
/Customers/divyanshubhargava/StudioProjects/mason_demo/lib/cubit/auth/auth_state.dart (new)
import 'bundle:equatable/equatable.dart';
import 'bundle:flutter_bloc/flutter_bloc.dart';
half 'auth_state.dart';class AuthCubit extends Cubit<AuthState>
AuthCubit() : tremendous(const AuthState());
a part of 'auth_cubit.dart';class AuthState extends Equatable 
const AuthState();
Record<Object?> get props => [];
import 'bundle:bloc_test/bloc_test.dart';
import 'bundle:mason_demo/cubit/auth/auth_cubit.dart';
void foremost()
'emits [] when nothing is added',
construct: () => AuthCubit(),
count on: () => [],
sort: boolean
description: Use Equatable
default: false
immediate: Do you need to use Equatable?
// Your code
a part of '{#snakeCase}name_cubit{/snakeCase}.dart';class #pascalCase{identify}State/pascalCase #useEquatableextends Equatable/useEquatable {
const {#pascalCase}{{identify}}State{/pascalCase}();
Record<Object?> get props => [];

Record put in Bricks

mason listing//ormason ls

Add Bricks

mason add <BRICK_NAME>

Take away Bricks

mason take away <BRICK_NAME>
Need to Join?You'll be able to join with me on Twitter, Github and LinkedIn.

More Posts