Exporting Code

Export produces a Flutter project a team would keep: Riverpod for state, typed go_router routes, every string in an ARB, a smoke test per screen, lint and CI — and a clear line between the files Koolbase regenerates and the files that are yours.

What you own, what Koolbase owns

Everything under lib/generated/ and test/generated/, plus lib/l10n/app_en.arb, is Koolbase's: replaced whole on every export. Everything else — main.dart, pubspec.yaml, the README, the lint config, the CI workflow, l10n.yaml, any locale you add, any screen you write yourself — is yours and is written once.

project
text
lib/
  main.dart                 yours — three lines calling koolbaseMain()
  generated/                Koolbase's — replaced on export
    core/                   runtime helpers, l10n, mutations, app_state
    theme/                  tokens from the Designer's theme
    app/                    app.dart, routes.dart
    screens/                one file per screen (+ _state.dart when it has state)
    l10n/                   generated AppLocalizations
  l10n/
    app_en.arb              Koolbase's — every string, keyed by node id
    app_fr.arb              yours — add locales beside it
test/generated/             one smoke test per screen
.koolbase/export.json       what was generated, sha256 of each file

Keys follow ids, not names

Localization keys are anchored to screen and node ids. Rename a widget in the Designer and your app_fr.arb still matches. Equal English at two sites stays two entries — "Save" on an invoice and "Save" on a draft may translate differently.

Re-exporting without losing your work

Use the CLI. It replaces Koolbase's files transactionally, leaves yours untouched, and refuses if you edited a generated file by hand — so a change never disappears silently.

terminal
Bash
koolbase export apply ~/Downloads/koolbase_export.zip --into ./my_app
# Exported 34 files into ./my_app
# lib/generated/ is Koolbase's and is replaced on re-export.
# Everything else is yours; build outside lib/generated/.

If you need to change a generated screen, copy it out of lib/generated/, edit the copy, and route to it — the next export will not touch your copy.

The architecture, enforced

One shape, so a developer inheriting an export learns it once. No codegen: the providers and routes are written out, and the project builds anywhere Flutter does.

  • State — one Riverpod Notifier per screen with state, one AppState for values shared across screens; persisted values write through to shared_preferences; non-retained values reset on sign-out.
  • Mutations — every write, upload and function call runs through an AsyncValue notifier; pending is isLoading, failed is hasError, the error message maps through userMessageFor.
  • Routing — go_router with a typed class per screen: ProductRoute(productId: id).push(context).
  • Forms — validated fields are TextFormFields inside a Form: silent until first blur, live after, all revealed on submit.
  • Lists — KoolbaseCollectionList owns fetching, cache and refresh; search filters what it has loaded.

Running it

terminal
Bash
flutter pub get
flutter gen-l10n
flutter analyze
flutter test
flutter run --dart-define=KOOLBASE_PUBLIC_KEY=pk_live_...

On the web, once: flutter create . --platforms web (Koolbase never writes platform folders), then flutter run -d chrome --web-port 8080 and add http://localhost:8080 under Configuration → Trusted Origins in the dashboard. Code push and offline sync are not available on the web; everything else is.

Or just press Run

You do not have to export to see the real app. Run builds it for you and opens it in the Designer's phone frame in about three minutes.

What the manifest says

.koolbase/export.json lists every generated file with its hash, the developer-owned files, and — when the app uses the camera or photo library — the platform configuration you must add yourself (iOS usage strings), which Koolbase never writes.