| íëĒŠ | ë´ėŠ |
| Invoke | /bloc:create |
| Aliases | /state:bloc, /flutter:bloc |
| Category | petmedi-development |
| Complexity | moderate |
| MCP Servers | serena, context7 |
/bloc:create#
Generates BLoC/Cubit state management components.
đ Details Pattern: BLoC Pattern
Usage#
/bloc:create {feature_name} {bloc_name} [--options]
Parameters#
| Parameter | Required | Description | Example |
feature_name |
â
|
Feature Module name |
home, auth, store |
bloc_name |
â
|
BLoC Name |
Home, Login, Cart |
--type |
â |
Type |
bloc, cubit (default: bloc) |
--location |
â |
Location |
application, common, console |
--usecases |
â |
UseCases to connect |
GetUser,UpdateUser |
Generated Files#
feature/{location}/{feature_name}/lib/src/presentation/bloc/
âââ {bloc_name}_bloc.dart # BLoC ęĩŦí
âââ {bloc_name}_event.dart # Event ė ė (sealed class)
âââ {bloc_name}_state.dart # State ė ė (Freezed)
Core Rules#
- Event:
sealed class + private _ prefix Class
-
State: Freezed union type (
initial, loading, loaded,
error)
- UseCase:
const UseCase() Direct creation (DI not used)
- Safety:
await After must if (isClosed) return; Check
Examples#
# Home feed BLoC
/bloc:create home Home --usecases GetFeed,RefreshFeed
# Auth login Cubit
/bloc:create auth Login --type cubit --location common
# Admin dashboard BLoC
/bloc:create dashboard Dashboard --location console
MCP Integration#
| MCP Server | Purpose |
| Context7 | flutter_bloc official documentation |
| Serena | Existing BLoC Pattern Analysis |