Skip to content

home_sdk Free

Home feature SDK with dashboard, profile, and settings pages using dual-GetIt DI pattern and per-feature slang translations.

Version: 1.0.0

Variables

VariableTypeDefaultDescription
appNamestringMyAppThe name of your application
prefixstringAppPrefix for generated classes (e.g. App, My)
uiKitPackageNamestringapp_ui_kitName of the UI kit package
isForMonorepobooleantrueWhether this will be part of a monorepo structure
stateManagementenumcubitState management solution: bloc, cubit, riverpod, provider

Generated Structure

features/
└── home/
    ├── home_api/
    │   ├── lib/
    │   │   ├── home_api.dart
    │   │   └── src/
    │   │       └── home_sdk.dart              # Home FeatureSDK contract
    │   └── pubspec.yaml
    └── home_impl/
        ├── l10n/                              # Per-feature translations
        │   ├── home_en.i18n.json
        │   └── home_id.i18n.json
        ├── lib/
        │   ├── home_impl.dart
        │   └── src/
        │       ├── home_sdk_impl.dart
        │       ├── di/
        │       │   ├── home_global_module.dart
        │       │   ├── home_local_module.dart
        │       │   └── injector.dart
        │       ├── l10n/
        │       │   └── home_translations.g.dart   # Generated by slang
        │       ├── presentation/
        │       │   ├── home_shell_page.dart        # Locale sync + DI scope
        │       │   ├── home/home_page.dart         # Uses context.homeL10n
        │       │   ├── profile/profile_page.dart
        │       │   └── settings/settings_page.dart # Uses context.homeL10n
        │       └── router/
        ├── slang.yaml                         # Home-specific slang config
        ├── build.yaml                         # Includes slang_build_runner
        └── pubspec.yaml

Per-Feature Translations

Home has its own slang configuration with feature-scoped translations:

yaml
# slang.yaml
translate_var: homeL10n       # Access via context.homeL10n
enum_name: HomeLocale
class_name: HomeTranslations

Translation strings cover dashboard, settings, and profile sections in English and Indonesian.

Key Features

  • Dual-GetIt DI — Global (HomeSDK) + local (repos, usecases) scoped to shell page lifecycle
  • Locale sync — Shell page maps global AppLocaleHomeLocale for feature-scoped translations
  • Localized settings — Language switcher uses slang translations for display names
  • Cross-feature navigation — Dashboard links to profile and settings via AutoRoute

State Management

The brick generates state management files based on the stateManagement variable passed from the parent flutter_modular_monorepo brick. Supported values: bloc, cubit, riverpod, provider.

Derived boolean variables computed in pre_gen.dart:

  • isBloc — true when stateManagement == bloc
  • isCubit — true when stateManagement == cubit
  • usesBloc — true when isBloc || isCubit (both use flutter_bloc)
  • isRiverpod — true when stateManagement == riverpod
  • isProvider — true when stateManagement == provider

Pages use typed design system extensions (context.colors, context.typography, etc.) instead of Theme.of(context).

Built by Banua Coder