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

The smf command of Say My Frame: generates Flutter apps from independent modules, such as a router, tabs, 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, 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, adds go_router for the start screen and generates a Flutter app with bottom tabs, BLoC and get_it

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.
--strict Stop instead of leaving out a module that cannot work in the app.
--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.

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 and the root widget. 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 with the name of the app.
bloc State management with flutter_bloc.
riverpod State management with flutter_riverpod.
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.
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.

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 #