fbloc CLI

A scaffolding CLI for Flutter projects with feature-first architecture and BLoC/Cubit state management.

Tip: Please use fbloc_cli v2.0.0 or newer β€” it's stable and error‑free.

What it does

  • Creates a new Flutter app with opinionated structure
  • Generates default features: home and auth
  • Scaffolds additional features and views on demand
  • Prints concise, user-friendly output with icons

Installation

From pub.flutter-io.cn:

dart pub global activate fbloc_cli

From source (local path):

dart pub get
dart pub global activate --source path .

Ensure your pub cache bin is on PATH so fbloc is available.

Usage

fbloc create project my_app

or the shorthand:

fbloc create my_app

Project creation will:

  • Prompt for configuration (Network, State Management, Navigation, Equatable)
  • Create Flutter project structure
  • Generate default home feature (with home_screen) and the full auth feature
  • Save preferences in .cli_config.json

Final output looks like:

πŸ“¦ Project "my_app" created successfully!

✨ Features generated:
   🧩 home, auth

πŸ“ Generated folders:
   πŸ“‚ app/features/home/ (with home_screen)
   πŸ“‚ app/features/auth/
   πŸ“‚ app/core/theme/
   πŸ“‚ app/core/utils/
   πŸ“‚ app/core/service/
   πŸ“‚ app/routes/

➑️  Next steps:
   ➀ cd my_app
   ➀ flutter pub get
   ➀ flutter run

Create a new feature

fbloc create feature auth

or

fbloc feature auth

Final output (concise):

✨ Feature generated: auth

Create a new view

fbloc view login on auth

Final output (concise):

πŸ–ΌοΈ View generated: login on auth

Configuration

On first project creation, you'll be prompted to configure:

  • Network package: http (default) or dio
  • State management: bloc (default) or cubit
  • Navigation: go_router (default) or navigator
  • Equatable: yes (default) or no

Configuration is saved in .cli_config.json and used for all subsequent feature/view generation.

Generated Structure

lib/
└── app/
  β”œβ”€β”€ features/
  β”‚   β”œβ”€β”€ home/
  β”‚   β”‚   β”œβ”€β”€ bloc/ or cubit/
  β”‚   β”‚   β”œβ”€β”€ repository/
  β”‚   β”‚   β”œβ”€β”€ model/
  β”‚   β”‚   └── view/
  β”‚   └── auth/
  β”‚       β”œβ”€β”€ bloc/ or cubit/
  β”‚       β”œβ”€β”€ repository/
  β”‚       β”œβ”€β”€ model/
  β”‚       └── view/
  β”œβ”€β”€ core/
  β”‚   β”œβ”€β”€ theme/
  β”‚   β”œβ”€β”€ utils/
  β”‚   └── service/
  └── routes/

Libraries

fbloc_cli