Skip to main content

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)PackageKindRole it providesAdds to the app
flutter_coresmf_flutter_corescaffoldApp entryThe Flutter project, main(), start-up and root widget, in every app, and the screen that an app starts on when no route starts it
go_routersmf_go_routerinfrastructureRouterThe router of the features' routes, with go_router
bottom_tabssmf_bottom_tabslayoutLayoutTabs at the bottom for the destinations of the features, in a bar that it draws in the colors of the theme
homesmf_home_flutterfeaturenoneA start screen at /home, which welcomes the developer of the app and lists the next steps
onboardingsmf_onboardingfeatureOnboarding screenThe onboarding at /onboarding, which the app shows on its first launch until the user finishes it, with the steps that other modules add
settingssmf_settingsfeatureSettings screenA settings screen at /settings, with the settings of the modules in one group, a row for each
sign_insmf_sign_infeaturenoneThe screens of sign-in, sign-up and password reset for an email address and a password, with a button for each other way to sign in of the app, and the screen of the account with its row on the settings screen, with BLoC or with Riverpod
paywallsmf_paywallfeaturenoneThe paywall at /paywall, which sells premium access with the plans of the current offer, the screen of the subscription at /paywall/subscription, its row on the settings screen and its step in the onboarding, with BLoC or with Riverpod
blocsmf_blocinfrastructureState managementflutter_bloc
riverpodsmf_riverpodinfrastructureState managementflutter_riverpod and its ProviderScope
material_themesmf_material_themeinfrastructureThemeA light and a dark Material 3 theme with a palette, text styles and a bundled font, in lib/core/theme/app_theme.dart
launcher_iconssmf_launcher_iconsinfrastructureApp iconAn opaque icon on iOS and an adaptive icon with a themed variant on Android, made with flutter_launcher_icons from two images in assets/branding/
native_splashsmf_native_splashinfrastructureSplash screenThe screen that the system shows while the app starts, for the light and the dark mode, made with flutter_native_splash from two images in assets/branding/
gen_l10nsmf_gen_l10ninfrastructureLocalizationThe texts of the app in ARB files, one for each language, with gen-l10n of Flutter
get_itsmf_get_itinfrastructureDependency injectionRegistration of the app's services in get_it
event_bussmf_event_businfrastructureEventsA CommunicationService on the event_bus package
shared_preferencessmf_shared_preferencesinfrastructurePreferencesAppPreferences on the shared_preferences package, for the settings that the app remembers
dart_definesmf_dart_defineinfrastructureValues in .envAppEnv, which gives the app the values of .env with --dart-define-from-file
local_notificationssmf_local_notificationsinfrastructureNotificationsNotifications now and at about a time to come, the permission to show them and the taps on them, with flutter_local_notifications
firebase_coresmf_firebase_coreinfrastructurenoneFirebase for each flavor: options, initialization, the script tool/configure_firebase.dart, setup of the machine
firebase_crashlyticssmf_firebase_crashlyticsinfrastructureCrash reportingA CrashReporter on Firebase Crashlytics
firebase_analyticssmf_firebase_analyticsinfrastructureAnalyticsAn AnalyticsService on Firebase Analytics, and screen views
firebase_messagingsmf_firebase_messaginginfrastructurePush messagesPush messages with Firebase Cloud Messaging: the address of the device for the backend, the messages and the taps on them
firebase_authsmf_firebase_authinfrastructureAuthenticationSign-in with Firebase Authentication: an email address and a password, an anonymous user, or a way to sign in of Google or Apple, and a script that enables the sign-in methods in the Firebase project
google_sign_insmf_google_sign_ininfrastructurenoneGoogle sign-in on Android and iOS: googleCredential(), the icon of its button with the "G" of Google, and a way to sign in for the auth role
apple_sign_insmf_apple_sign_ininfrastructurenoneSign in with Apple on iOS: appleCredential(), the icon of its button, a way to sign in for the auth role, and the entitlement of the capability in ios/Runner/Runner.entitlements
diosmf_dioinfrastructureREST APIThe requests of appRest over a Dio
revenuecatsmf_revenuecatinfrastructurePurchasesPremium access with RevenueCat: the plans of the default offering, a purchase, a restore, and the access of the user before the first frame
github_actionssmf_github_actionsinfrastructureCI.github/workflows/ci.yml: the checks on each push, and a release APK for an environment on request

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 and paywall do 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:

RoleFilesWhat they declare
App entryAGENTS.md, CLAUDE.md, lib/core/app/status_bar_icons.dart, test/core/app/status_bar_icons_test.dart, and the sections of the flavors and the steps by hand in README.mdThe guide for coding agents that work on the app; StatusBarIcons, which asks for the icons of the status bar that suit the theme, and its widget test
Onboarding screenlib/core/onboarding/onboarding_steps.dartOnboardingStep and appOnboardingSteps, the steps that the modules add to the onboarding
Routerlib/core/router/app_router.dart, lib/core/router/navigation.dartAppRouter, appRouter, the location classes and context.nav. In an app with guards, also routeGuards, redirectOf(), flowIsOver(), guardChanges and GuardedNavigation
Layoutlib/core/layout/destination.dartDestination, the label and icon of an item of the main navigation, and appDestinations, the destinations of the app
Themelib/core/theme/theme_mode.dart, and lib/core/theme/theme_mode_setting.dart in an app with a settings screenappThemeMode, the theme mode that the user selected, AppThemeModeScope and restoreAppThemeMode; ThemeModeSetting, the entry of the settings screen
Localizationlib/core/l10n/app_locale.dart, and lib/core/l10n/language_setting.dart in an app with a settings screenappLocales, the languages of the app, appLocale, the language that the user chose, AppLocaleScope and restoreAppLocale; LanguageSetting, the entry of the settings screen
Dependency injectionlib/core/di/service_locator.dartServiceLocator, resolve<T>()
Eventslib/core/events/communication_service.dartAppEvent, CommunicationService, createCommunicationService()
Preferenceslib/core/preferences/app_preferences.dartAppPreferences, initPreferences(), createAppPreferences()
Analyticslib/core/analytics/analytics_service.dartAnalyticsService, createAnalyticsService()
Crash reportinglib/core/crash_reporting/crash_reporter.dartCrashReporter, createCrashReporter(), installCrashReporting()
Authenticationlib/core/auth/app_session.dart, lib/core/auth/auth_service.dart, lib/core/auth/guest_data.dart, lib/core/auth/sign_in_methods.dartappSession, the session of the app, authMode and initAuth(); AuthService, the interface of a provider, AuthFailure and SignInCredential; takeGuestData(), which the developer of the app edits; SignInMethod and appSignInMethods, the ways to sign in of the app
Notificationslib/core/notifications/app_notifications.dart, lib/core/notifications/notifications_service.dart, android/app/src/main/res/drawable/ic_notification.xml, android/app/src/main/res/raw/notifications_keep.xml, lib/core/notifications/notifications_setting.dart in an app with a settings screen, and lib/core/notifications/notifications_step.dart in an app with an onboardingappNotifications, NotificationPermission and initNotifications(); NotificationsService, AppNotification and NotificationTap; the small icon of Android and the file that keeps it in a release build; NotificationsSetting, the entry of the settings screen; notificationsStepShows() and allowNotifications(), the functions of the step of the onboarding
Push messageslib/core/push/app_push.dart, lib/core/push/push_service.dartappPush and initPush(); PushService, the interface of a provider, and PushMessage
Purchaseslib/core/purchases/app_purchases.dart, lib/core/purchases/purchases_service.dart, and lib/core/purchases/restore_purchases_setting.dart in an app with a settings screenappPurchases, the premium access of the user, and initPurchases(); PurchasesService, the interface of a provider, AppAccess, Plan and PurchasesFailure; RestorePurchasesSetting, the entry of the settings screen
Values in .env.env, .env.example, a line of .gitignore, .vscode/launch.json and .run/<flavor>.run.xmlThe values that you fill in, the same keys without values, the line that keeps .env out of git, and a run configuration for each flavor. Every provider generates AppEnv in lib/core/env/app_env.dart, with a getter for each key
REST APIlib/core/rest/app_rest.dart, lib/core/rest/rest_transport.dart, lib/core/rest/session_tokens.dart in an app with sign-in, test/core/rest/rest_test_server.dart, test/core/rest/app_rest_test.dart, and the permission android.permission.INTERNETappRest, the REST client of the app, RestFailure, RestResponse and RestCancel; RestTransport, the interface of a provider; what gives the client the token of appSession; RestTestServer, a local server for the tests of the app; a real request through the provider
CItool/write_env.dart in an app with values in .envThe script that writes .env for a job. The commands of CI are in the README, and a provider writes them in the format of its host

The state management role, the settings screen role, the app icon role and the splash role have no files of their own that code reads: screens use the state management libraries directly, the module that provides the settings screen generates the screen, and each module of the icon and the screen generates its two images in assets/branding/. Besides the files above, 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 step of the onboarding, a text, a key of .env. In an app with every module above, the router, the preferences, the settings screen, the onboarding and the localization get these from the modules, and from four roles. The services of the modules and what follows the screens are on the pages of the modules.

FromRoutes and guardsRestorer of the preferencesRow of the settings screenTexts, in English and in Ukrainian
home/home, a destinationThe label of its tab, and the 14 texts of its screen
onboarding/onboarding, and the guard onboarding.firstRunrestoreOnboardingThe six texts of its screen
settings/settings, a destinationThe 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.hasAccountAccountThe 49 texts of its screens
google_sign_in, apple_sign_inThe label of the button of each, Continue with Google and Continue with Apple
paywall/paywall, and /paywall/subscription, which asks for premium access, and the guard paywall.hasPremiumSubscriptionThe 65 texts of its screens, the three texts of its row, and the four texts of its step of the onboarding, Unlock premium
The theme role, with material_themerestoreAppThemeModeThemeThe four texts of its row
The localization role, with gen_l10nrestoreAppLocaleLanguageThe two texts of its row
The notifications role, with local_notificationsrestoreNotificationsNotificationsThe three texts of its row, and the four texts of its step of the onboarding, Turn on notifications
The purchases role, with revenuecatRestore purchasesThe four texts of its row

So the settings screen of such an app has the rows Account and Subscription, and after them the rows Theme, Language, Notifications and Restore purchases, in the order of the modules that provide the four roles. The onboarding shows the step of the notifications and then the step of the paywall before its last page. The preferences restore four settings before the first frame, and the router asks four guards: the gate of the onboarding, then the gate of the sign-in, then the guard of the routes that need an account, and last the guard of the routes that need premium access. Such an app starts on /home, so flutter_core gives it no texts: only an app that no route starts has the two texts of its fallback start screen. revenuecat gives the role of the values in .env the three API keys of RevenueCat, paywall the addresses of its terms of use and its privacy policy, and the REST role the address of the API; see Values in .env. A module of your own gives the roles the same things; see Extending SMF.

Three 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/, google_sign_in the "G" of Google for its button, in lib/core/google_sign_in/assets/, and material_theme the font of its themes with its license, in assets/fonts/geist/.