flutter-bloc-gen
Generate Bloc or Cubit boilerplate for Flutter with Equatable support and common utilities.
Features
- Quickly generate Cubit or Bloc with state management boilerplate.
- Includes Equatable for easy state comparisons.
- Generates separate files for state, cubit/bloc, and event (for Bloc).
- Includes common helper functions:
copyWith
resetState
API call simulation
Dialog showing function with context
- Supports common data types (int, String, bool, List, DateTime, etc.)
- Saves generated files in a folder with the chosen name.
- Automatically copies all generated code to clipboard for easy pasting.
How to Use
- Open a Flutter project in VS Code.
- Press
Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (Mac) to open the Command Palette.
- Search and run Generate Bloc or Cubit Boilerplate.
- Choose either Cubit or Bloc.
- Enter a name for your Bloc/Cubit (e.g.,
AuthBloc or CounterCubit ).
- Generated files will be saved in a folder named after your input and copied to the clipboard.
Example
Cubit:
Folder CounterCubit/ contains:
counter_cubit.dart
counter_state.dart
Bloc:
Folder AuthBloc/ contains:
auth_bloc.dart
auth_event.dart
auth_state.dart
All files include ready-to-use Equatable boilerplate, copyWith , resetState , API simulation, and helper methods.
Requirements
- Flutter & Dart installed.
- VS Code with Flutter and Dart extensions.
Extension Settings
This extension currently does not have configurable settings.
Release Notes
0.0.1
- Initial release
- Bloc & Cubit boilerplate generator with Equatable support
- Files copied to clipboard and saved to folder
- Common helper methods included
| |