Skip to main content

flutter_core

PackageKindProvides the roleNeedsChoose with
smf_flutter_corescaffoldApp entrynothingadded to every app

flutter_core creates the Flutter app that every SMF app starts from: the Android and iOS projects, main(), the start-up sequence, the root widget and pubspec.yaml. It provides the app entry role, and every app needs exactly one provider of that role, so smf create adds flutter_core to every app.

What it adds to the app​

FileWhat it holds
lib/main.dartmain(): WidgetsFlutterBinding.ensureInitialized(), await bootstrap(), then runApp() with the root widget inside the wrappers of other modules.
lib/bootstrap.dartbootstrap(), where the other modules put their start-up code, phase by phase. It imports neither material nor cupertino.
lib/app.dartApp, the root widget: a MaterialApp.router with the router's configuration when the app has a router, or else a MaterialApp that shows the fallback start screen. Its builder holds the widgets that other modules put around the content of every route.
lib/core/app/fallback_start_screen.dartFallbackStartScreen, a screen with the name of the app, for an app without a screen to start on.
test/core/app/fallback_start_screen_test.dartA widget test of the fallback start screen.
pubspec.yamlThe dependencies of all modules, with Dart ^3.12.0 and Flutter >=3.44.0, and flutter_lints for the lints.
analysis_options.yamlThe lints of a new Flutter app, with build/** left out of the analysis.
README.mdThe name of the app, and the sections that other modules add.
.gitignore, .metadataThe files of the same names that flutter create writes.
android/, ios/The projects of flutter create of Flutter 3.44, with the identifiers of the app.

The native projects are those that flutter create --platforms=android,ios writes with Flutter 3.44.2, with a few changes:

  • The names and identifiers come from the app. The Android label and the iOS display name are the name of the app in title case. The Android namespace, application id and Kotlin package path, and the iOS bundle id, come from --org and the app name.
  • The minimum iOS version is 15.0, the lowest that Xcode 27 builds for, unless a module needs a higher one. The Xcode project has no development team.
  • The Android manifest, Info.plist and the Gradle files have places where other modules add permissions, keys and plugins.

Start-up phases​

bootstrap() runs the start-up code that modules and roles add, in four phases, in this order:

PhaseWhat goes there
earlyCode that must come before anything else
platformPlatform services, such as await Firebase.initializeApp(...) and installCrashReporting()
DIThe services of the app: await registerDependencies();
lateCode that needs those services

main() runs the root widget inside the wrappers that modules add, such as the ProviderScope of Riverpod.

Choosing it​

You never choose it. Every app has it, and smf create adds it by itself.

Requirements​

The app needs Flutter 3.44 or newer and Dart 3.12 or newer, and runs on iOS 15 or newer. For iOS builds with Xcode 27, see troubleshooting.