Skip to main content

smf_flutter_cli 0.6.0 copy "smf_flutter_cli: ^0.6.0" to clipboard
smf_flutter_cli: ^0.6.0 copied to clipboard

The smf command of Say My Frame: generates Flutter apps from independent modules, such as a router, tabs, sign-in, dependency injection, state management and Firebase.

SMF Flutter CLI #

smf generates Flutter apps from independent modules. You pick what the app needs, such as a router, tabs at the bottom, sign-in, dependency injection, a state manager, Firebase or a start screen, and smf create generates a Flutter project in which these parts already work together. The project does not depend on SMF at run time, so its code is yours from the first commit.

smf create in a terminal: it asks for the app name and the modules, among them Google sign-in, Sign in with Apple, the onboarding and the notifications, adds the modules that the chosen ones need, such as go_router, the settings screen and Firebase Authentication, asks who may use the app without an account, and generates a Flutter app with an onboarding, a start screen, sign-in with email, Google and Apple, tabs at the bottom, a theme, two languages, notifications, get_it and BLoC

With the modules onboarding, sign_in, google_sign_in, apple_sign_in, home, bottom_tabs, material_theme, gen_l10n and local_notifications, the app opens on an onboarding that asks for the permission to show notifications, and then asks the user to sign in with Google, with Apple on iOS or with an email address. It has a start screen, an account screen, a settings screen with a theme mode, a language and the notifications, and a light and a dark theme:

The app that smf create generates, on a phone: the onboarding, the sign-in with Google, Apple and an email address, the start screen, and the account screen in the dark theme and in Ukrainian

sign_in needs a Firebase project for its accounts. The other modules of this app need none.

SMF generates apps for Flutter 3.44 or newer and Dart 3.12 or newer. It is tested on macOS, Linux and Windows.

The documentation is at doc.saymyframe.com.

Install #

dart pub global activate smf_flutter_cli
smf --version

smf create uses the Flutter SDK of the flutter on your PATH.

Create an app #

In a terminal, smf create asks for what the command line does not give: the name of the app, its organization and its modules:

smf create

With the modules on the command line and --no-input, it asks nothing:

smf create my_app --org com.example -m home,bottom_tabs,get_it,bloc --no-input

smf create adds the modules that the chosen ones need, such as go_router for the start screen of home. The main options:

Option What it does
-m, --modules The modules, separated by commas.
--org The organization in reverse domain notation, com.example by default.
-o, --output The directory in which the app's directory is created.
--no-input Ask nothing; everything comes from the options.
--explain Print what would be generated and whether the machine is ready, then stop. It makes no choices, so --strict does not stop it on a warning that only a choice reports, such as an app without a route to start on.
--strict Stop instead of leaving out a module that cannot work in the app, and stop on a warning about what the app is made of, such as a destination that no main navigation leads to.
--skip-external-setup Never install tools, log in or configure external services.
--on-conflict What to do when the app's directory exists and is not empty: prompt, replace, copy or cancel.
--start The full path of the screen the app starts on, such as /home.
--locales The languages of the app among those that the texts of its modules are in, such as en,uk. All of them by default.
--auth-mode Who may use the app without an account: nobody (required, the default), everyone (guest), or everyone as an anonymous user (anonymous).

smf create exits with 0 on success, 1 when generation failed, 64 for a wrong command line, 70 for an unexpected error and 130 when you cancel it. The reference of smf create has the details.

Modules #

Module What it adds to the app
flutter_core The Flutter project for Android and iOS, main(), the start-up, the root widget, and the screen that an app shows while it has no screen to start on. Every app has it.
go_router Routes and a typed navigation facade, with go_router.
bottom_tabs The main navigation as tabs in a bar at the bottom.
home A start screen that welcomes the developer of the app, with the name of the app and the next steps.
settings A settings screen with the settings of the modules of the app in one group, a row for each.
onboarding An onboarding that a new user goes through on the first launch, before every other screen. Other modules can add steps to it, such as a page that asks for the permission to show notifications.
material_theme A light and a dark Material 3 theme with a palette and a bundled font, and the theme mode that the user selects, which the app remembers.
bloc State management with flutter_bloc.
riverpod State management with flutter_riverpod.
gen_l10n Localization with gen-l10n of Flutter: the texts of the modules in ARB files, one for each language of the app.
get_it Dependency injection: the services of the modules, registered in get_it.
event_bus Events between parts of the app that do not know each other, with event_bus.
shared_preferences The settings of the app that are no secret, such as the theme mode, remembered between its launches with shared_preferences.
local_notifications Notifications with flutter_local_notifications: a notification now or at about a time to come, the permission to show them, and the taps on them.
firebase_core Firebase, set up with flutterfire configure after generation.
firebase_crashlytics Crash reporting with Firebase Crashlytics.
firebase_analytics Analytics with Firebase Analytics and, with a router, a screen view for each screen the user sees.
firebase_messaging Push messages with Firebase Cloud Messaging: the address of the device for a backend, the messages that arrive and the taps on them.
firebase_auth Sign-in with Firebase Authentication: an email address and a password, or an anonymous user. The sign-in methods are enabled in the Firebase project after generation.
google_sign_in Google sign-in on Android and iOS, a way to sign in next to email for the provider of sign-in, such as firebase_auth.
apple_sign_in Sign in with Apple on iOS, a way to sign in next to email for the provider of sign-in, such as firebase_auth.
sign_in Screens of sign-in, sign-up and password reset with an email address and a password, with a button for each way to sign in of the app, and the screen of the account with its entry on the settings screen, with BLoC or with Riverpod.

A module knows only the modules it depends on. A screen needs a router, not go_router, and analytics follows the screens of whichever router the app has. SMF calls these shared parts roles: a module that needs a role works with every module that provides it. You can also write modules of your own, and a command of your own with them; see Extending SMF.

Support #