Modules
These are the modules that smf create offers. Each one is a Dart package on pub.dev, but you never add them to an app yourself: smf create puts what they generate into the app.
Module (-m) | Package | Kind | Role it provides | Adds to the app |
|---|---|---|---|---|
flutter_core | smf_flutter_core | scaffold | App entry | The Flutter project, main(), start-up, root widget, and the screen that an app shows while it has no screen to start on; in every app |
go_router | smf_go_router | infrastructure | Router | The router of the features' routes, with go_router |
bottom_tabs | smf_bottom_tabs | layout | Layout | Tabs at the bottom for the destinations of the features, in a bar that it draws in the colors of the theme |
home | smf_home_flutter | feature | none | A start screen at /home, which welcomes the developer of the app and lists the next steps |
onboarding | smf_onboarding | feature | none | The onboarding at /onboarding, which the app shows on its first launch until the user finishes it |
settings | smf_settings | feature | Settings screen | A settings screen at /settings, with the settings of the modules in one group, a row for each |
sign_in | smf_sign_in | feature | none | The screens of sign-in, sign-up and password reset for an email address and a password, and the screen of the account with its row on the settings screen, with BLoC or with Riverpod |
bloc | smf_bloc | infrastructure | State management | flutter_bloc |
riverpod | smf_riverpod | infrastructure | State management | flutter_riverpod and its ProviderScope |
material_theme | smf_material_theme | infrastructure | Theme | A light and a dark Material 3 theme with a palette, text styles and a bundled font, in lib/core/theme/app_theme.dart |
gen_l10n | smf_gen_l10n | infrastructure | Localization | The texts of the app in ARB files, one for each language, with gen-l10n of Flutter |
get_it | smf_get_it | infrastructure | Dependency injection | Registration of the app's services in get_it |
event_bus | smf_event_bus | infrastructure | Events | A CommunicationService on the event_bus package |
shared_preferences | smf_shared_preferences | infrastructure | Preferences | AppPreferences on the shared_preferences package, for the settings that the app remembers |
firebase_core | smf_firebase_core | infrastructure | none | Firebase: options, initialization, setup of the machine |
firebase_crashlytics | smf_firebase_crashlytics | infrastructure | Crash reporting | A CrashReporter on Firebase Crashlytics |
firebase_analytics | smf_firebase_analytics | infrastructure | Analytics | An AnalyticsService on Firebase Analytics, and screen views |
firebase_auth | smf_firebase_auth | infrastructure | Authentication | Sign-in with Firebase Authentication: an email address and a password, or an anonymous user, and a script that enables the sign-in methods in the Firebase project |
The kind of a module decides the rules it follows. A feature keeps its files in lib/features/<id>/ and declares routes, a layout provides the main navigation, and infrastructure sets up a service or a library without screens of its own. A feature can provide a role too, as settings does, and it can keep its state with the state manager of the app, as sign_in does in a variant for each. See the module model.
Roles and their files
A role generates the part of the app that other code counts on, whichever module provides it. These files belong to the roles rather than to a module:
| Role | Files | What they declare |
|---|---|---|
| App entry | AGENTS.md, CLAUDE.md | The guide for coding agents that work on the app |
| Router | lib/core/router/app_router.dart, lib/core/router/navigation.dart | AppRouter, appRouter, the location classes and context.nav. In an app with guards, also routeGuards, redirectOf(), flowIsOver(), guardChanges and GuardedNavigation |
| Layout | lib/core/layout/destination.dart | Destination, the label and icon of an item of the main navigation, and appDestinations, the destinations of the app |
| Theme | lib/core/theme/theme_mode.dart, and lib/core/theme/theme_mode_setting.dart in an app with a settings screen | appThemeMode, the theme mode that the user selected, AppThemeModeScope and restoreAppThemeMode; ThemeModeSetting, the entry of the settings screen |
| Localization | lib/core/l10n/app_locale.dart, and lib/core/l10n/language_setting.dart in an app with a settings screen | appLocales, the languages of the app, appLocale, the language that the user chose, AppLocaleScope and restoreAppLocale; LanguageSetting, the entry of the settings screen |
| Dependency injection | lib/core/di/service_locator.dart | ServiceLocator, resolve<T>() |
| Events | lib/core/events/communication_service.dart | AppEvent, CommunicationService, createCommunicationService() |
| Preferences | lib/core/preferences/app_preferences.dart | AppPreferences, initPreferences(), createAppPreferences() |
| Analytics | lib/core/analytics/analytics_service.dart | AnalyticsService, createAnalyticsService() |
| Crash reporting | lib/core/crash_reporting/crash_reporter.dart | CrashReporter, createCrashReporter(), installCrashReporting() |
| Authentication | lib/core/auth/app_session.dart, lib/core/auth/auth_service.dart, lib/core/auth/guest_data.dart | appSession, the session of the app, authMode and initAuth(); AuthService, the interface of a provider, and AuthFailure; takeGuestData(), which the developer of the app edits |
The state management role and the settings screen role have no files of their own: screens use the state management libraries directly, and the module that provides the settings screen generates the screen. Besides the guide for coding agents, the files of the app entry come from flutter_core.
Routes, settings and texts of the modules
A module does not reach into another module. It gives a role what the role collects from every module: a route, a guard, a restorer of a setting, a row of the settings screen, a text. In an app with every module above, the router, the preferences, the settings screen and the localization get these from the modules, and from two roles. The services of the modules and what follows the screens are on the pages of the modules.
| From | Routes and guards | Restorer of the preferences | Row of the settings screen | Texts, in English and in Ukrainian |
|---|---|---|---|---|
flutter_core | The two texts of its fallback start screen | |||
home | /home, a destination | The label of its tab, and the 14 texts of its screen | ||
onboarding | /onboarding, and the guard onboarding.firstRun | restoreOnboarding | The six texts of its screen | |
settings | /settings, a destination | The title of its screen, which is the label of its tab too | ||
sign_in | /sign_in with /sign_in/sign_up and /sign_in/reset_password below it, /sign_in/account, which asks for an account, and the guards sign_in.gate and sign_in.hasAccount | Account | The 42 texts of its screens | |
The theme role, with material_theme | restoreAppThemeMode | Theme | The four texts of its row | |
The localization role, with gen_l10n | restoreAppLocale | Language | The two texts of its row |
So the settings screen of such an app has the row Account, and after it the rows Language and Theme, in the order of the modules that provide the two roles. The preferences restore three settings before the first frame, and the router asks three guards: the gate of the onboarding, then the gate of the sign-in, then the guard of the routes that need an account. A module of your own gives the roles the same things; see Extending SMF.
Two modules also add files that are not code, and declare them in pubspec.yaml: home the image of its screen, in lib/features/home/assets/, and material_theme the font of its themes with its license, in assets/fonts/geist/.