Skip to content

Install & Create a Project

This page is for fluzer users: how to install it, create a project, generate a feature module, and run it. All commands and skeletons are based on the real code.


1. Install fluzer

dart pub global activate fluzer

For local development you can also run it directly: dart run bin/fluzer.dart <command> (inside the flutter_zero_cli repository).

Verify it is on your PATH after installing:

fluzer version

2. Create a project

fluzer create my_app

What create does (create_command.dart):

  1. Validate the project name (must start with a lowercase letter; only lowercase letters, digits, and underscores).
  2. Render the project brick (only the name variable) into the current directory, generating the ./<name> project directory directly.
  3. Run flutter create . --org <org> --project-name <name>.
  4. Remove the redundant test file (widget_test.dart) generated by flutter create.
  5. Run flutter pub get.
  6. Run flutter gen-l10n.
  7. Run build_runner (optional; skip with --no-build-runner).

Available options:

fluzer create my_app \
  --org com.example \
  --no-build-runner
Option Default Description
--org com.example Organization identifier; affects the bundle ID
--no-build-runner Skip the build_runner step after generation
--build-runner enabled Run build_runner after generation (default; negatable)

After creation, enter the project:

cd my_app
flutter pub get
flutter gen-l10n
dart run build_runner build
flutter run

3. Add a feature module

fluzer new login

new will:

  • Render the feature brick into lib/features/login/.
  • Inject LoginModule.register(getIt) into the registerFeatureModules region of core/di/injection_base.dart.
  • Run build_runner by default (skip with --no-build-runner).

The generated skeleton (excerpt from the brick):

// lib/features/login/login_module.dart
class LoginModule {
  LoginModule._();
  static void register(GetIt getIt) {
    getIt.registerLazySingleton<LoginRepository>(
      () => LoginRepository(client: getIt<DioClient>()),
    );
  }
}
// lib/features/login/presentation/pages/login_page.dart
class LoginPage extends StatelessWidget {
  const LoginPage({super.key, this.bloc});
  final LoginBloc? bloc;

  @override
  Widget build(BuildContext context) {
    return BlocProvider(
      create: (_) => bloc ?? LoginBloc(repository: getIt<LoginRepository>()),
      child: const EffectListener<LoginBloc, LoginState>(
        effectsHandles: [loginEffectHandle],
        child: LoginBody(),
      ),
    );
  }
}

loginEffectHandle is the business handler function exported from presentation/effects/login_effect_handle.dart; EffectListener places it at the front of the responsibility chain, and the framework's default handles fall back at the end of the chain.


4. Next steps

After the skeleton is generated, the directory contains freezed empty shells (with guiding comments) and a Bloc placeholder that already mixes in the four Mixins. The next step is Write Your First Feature — a complete example showing how to wire the packaged Mixins / Effect / error system / BaseRepository together to write business logic.

About the version command

Running fluzer version shows the current version and automatically checks pub.dev for updates (available results cached for 24h, unavailable results for 10min, with silent degradation). See CLI Reference for details.