Skip to content

Install & Create a Project

fluzer template

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

For a different interface language, add the global --locale flag (e.g. fluzer --locale en version); -l enables debug mode — add it first when troubleshooting.


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.

Available options:

fluzer create my_app \
  --org com.example
Option Default Description
--org com.example Organization identifier; affects the bundle ID

After creation, enter the project:

cd my_app
flutter pub get
flutter gen-l10n
flutter run

A freshly created template already ships every generated artifact, so build_runner is usually unnecessary; you only need dart run build_runner build after adding your own freezed modules.


3. Add a feature module

fluzer new login

new will:

  • Render the matching feature brick into lib/features/login/ (BLoC by default, --cubit for the Cubit pattern).
  • 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(dio: getIt<Dio>()),
    );
  }
}
// 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.


Source of this page: docs/en/getting-started/index.md

Report an error on this page