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; 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 |
home | smf_home_flutter | feature | none | A start screen at /home |
bloc | smf_bloc | infrastructure | State management | flutter_bloc |
riverpod | smf_riverpod | infrastructure | State management | flutter_riverpod and its ProviderScope |
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 |
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 |
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. 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 |
|---|---|---|
| Router | lib/core/router/app_router.dart, lib/core/router/navigation.dart | AppRouter, appRouter, the location classes and context.nav |
| Layout | lib/core/layout/destination.dart | Destination, the label and icon of an item of the main navigation |
| Dependency injection | lib/core/di/service_locator.dart | ServiceLocator, resolve<T>(), resolveWith<T>() |
| Events | lib/core/events/communication_service.dart | AppEvent, CommunicationService, createCommunicationService() |
| Analytics | lib/core/analytics/analytics_service.dart | AnalyticsService, createAnalyticsService() |
| Crash reporting | lib/core/crash_reporting/crash_reporter.dart | CrashReporter, createCrashReporter(), installCrashReporting() |
The app entry and the state management role have no files of their own. flutter_core generates the files of the app entry, and screens use the state management libraries directly.