Skip to main content

bclean 0.1.0 copy "bclean: ^0.1.0" to clipboard
bclean: ^0.1.0 copied to clipboard

A powerful CLI tool for Flutter to generate Clean Architecture with BLoC or Cubit state management and dartz error handling, inspired by get_cli.

bclean #

A fast, get_cli-inspired CLI tool for Flutter & Dart to scaffold Clean Architecture projects with BLoC / Cubit state management and dartz (Either<Failure, T>) functional error handling.

Installation (Local Development) #

Activate globally from this directory:

dart pub global activate --source path .

Commands & Usage #

1. Initialize Clean Architecture Core (bclean init) #

Generates:

  • lib/core/error/failures.dart & exceptions.dart
  • lib/core/usecases/usecase.dart (with dartz Either<Failure, Type>)
  • lib/core/network/network_info.dart
  • lib/core/router/app_router.dart
  • lib/injection_container.dart (get_it)
  • Automatically adds flutter_bloc, equatable, dartz, and get_it to pubspec.yaml.
bclean init

2. Create a Full Feature (bclean create feature:<name>) #

Generates Entity, Repository Interface, UseCase, Model, Remote & Local DataSources, Repository Implementation, BLoC (Event + State) or Cubit, Page, and auto-registers everything in injection_container.dart and app_router.dart:

bclean create feature:auth

Options:

  • Use Cubit instead of BLoC:
    bclean create feature:profile --cubit
    
  • Skip LocalDataSource:
    bclean create feature:orders --no-local
    

3. Create Sub-Components inside an Existing Feature #

  • UseCase (Also auto-adds method to Domain Repository, Data RepositoryImpl, and injection_container.dart!):
    bclean create usecase:login on auth
    
  • BLoC / Cubit:
    bclean create bloc:session on auth
    bclean create cubit:theme on settings
    
  • Page (Also auto-registers route in app_router.dart):
    bclean create page:register on auth
    

4. Generate Domain Entity & Data Model from JSON (bclean generate model) #

Parses any JSON file (including nested objects and arrays) and generates both the Domain Entity (Equatable) and Data Model (fromJson, toJson, copyWith):

bclean generate model on auth with assets/models/user_profile.json

Options:

  • Custom model name: --name custom_user
  • Generate only Data Model without Domain Entity: --skip-entity

5. Optional Project Configuration in pubspec.yaml #

You can configure project-wide defaults in your Flutter project's pubspec.yaml:

bclean:
  state_management: bloc # or cubit
  include_local: true
1
likes
0
points
371
downloads

Publisher

verified publisherrobiulsuny.com

Weekly Downloads

A powerful CLI tool for Flutter to generate Clean Architecture with BLoC or Cubit state management and dartz error handling, inspired by get_cli.

Repository (GitHub)
View/report issues

Topics

#cli #bloc #clean-architecture #codegen #flutter

License

unknown (license)

Dependencies

args, path, yaml

More

Packages that depend on bclean