Skip to Content
gentlemans-stack

Flutter target preset

The Nx targets every Flutter app under apps/ gets from the mobile-app generator, and what each one runs.

Every Flutter app under apps/ gets the same Nx targets from nx-plugin:mobile-app. Targets that wrap a Flutter CLI call run the CLI directly; targets with logic call one script in scripts/flutter/, so the logic lives in one place and each target stays a one-line call.

Always

TargetRunsNotes
pub-getflutter pub getInput: pubspec.yaml
analyzeflutter analyzeMust be clean
formatdart format lib testWrites
format-checkdart format --set-exit-if-changed lib testCI form of format
testflutter test
runflutter runContinuous; needs a device or simulator
refreshflutter clean && flutter pub getUse after native or plugin changes
build-checkscripts/flutter/build-check.mjsDebug build of every platform the app has
run-allscripts/flutter/run-all.mjsDebug build on every connected phone and this Mac
build-releasescripts/flutter/build-release.mjsRelease build on every connected device and this Mac
bundlescripts/flutter/build-bundles.mjsStore artifacts: .aab, .ipa, Mac .pkg
rename-appscripts/flutter/rename-app.mjs --name "<Name>"Display name on every platform folder the app has

Fonts from google_fonts: node scripts/flutter/bundle-fonts.mjs scan|fetch|verify [app] (not a target; driven by the flutter-bundle-google-fonts skill).

analyze, test, run and the builds depend on pub-get and design-tokens:generate.

Per platform

Chosen with --platforms (default ios,android). A target exists only when its platform does.

TargetPlatformRuns
build-apkandroidflutter build apk
build-iosiosflutter build ios
build-macosmacosflutter build macos
build-webwebflutter build web

Opt-in

TargetFlagRunsNeeds
sync-api--syncApiscripts/flutter/sync-api-schema.mjsA running backend; swagger_parser in the app
codegen--codegenscripts/flutter/codegen.mjsbuild_runner in the app

Generator flags

pnpm nx g @gentlemans-stack/nx-plugin:mobile-app <name> --platforms=ios,android,web,macos --syncApi --codegen

--platforms also passes to flutter create, so the platform folders match the targets.

Existing apps

The three existing apps run the same .mjs scripts as the stack. Each keeps its own DEFAULT_APP in scripts/flutter/lib/app.mjs. The copies are manual until the Phase 5 sync.

  • wemove-mobile and mqtizermqtt_client: generate-assets runs the same script as the stack.
  • desk_mate: generate-assets added (it has both YAML configs).
  • desk_mate (Nx name desk-mate): has no codegen (no build_runner). bundle is present, but it signs the Android build with the debug key until android/key.properties exists, so Play rejects the upload. The script warns about this.

Assets and store images

Every generated app has these three targets (no flag), each a one-line call to a script that takes --dry-run:

TargetScriptRunsNeeds
generate-assetsscripts/flutter/generate-assets.mjsflutter_launcher_icons and flutter_native_splashThe two YAML files (generated, same shape as the flutter-brand-icons skill writes) and assets/icon/light.png
capturescripts/flutter/capture.mjsimage-gen-tools:capture (flutter drive on integration_test/capture_test.dart)apps/<app>/image-gen.config.json; booted simulators or this Mac
store-assetsscripts/flutter/store-assets.mjsimage-gen-tools:store (cards, feature graphic, listing icons into dist/<app>/store/)The config and the captures

generate-assets skips a step whose YAML is missing and exits 0, so an app without icons yet is not an error. It overwrites committed platform files, so run it when the artwork changes, not on every build. The generator also writes the capture harness (integration_test/capture_test.dart, test_driver/integration_test.dart, an empty integration_test/capture_actions.dart) and adds flutter_launcher_icons, flutter_native_splash and integration_test to the dev dependencies. Colors in the YAML are placeholders; the flutter-brand-icons skill regenerates both files and the PNGs from the logo and the theme.

Why a script, not a shell line

A target becomes a script when it does more than one thing or needs to read the app (its bundle id, which platforms it has). Scripts take --dry-run, which prints the commands without running them.

On this page