minikit docs v0.1.0-alpha.3

Adding the framework to a host app

A host app — a super app that opens mini apps — depends on mini_app_host, which brings mini_app_bridge and mini_app_core. minikit add vendors them into the app, like minikit create vendors the SDK into a mini app, so the app builds with plain Flutter, offline and in CI.

cd my_superapp
minikit add                  # mini_app_host + bridge + core into packages/
minikit add --dir third_party
minikit add bridge           # just the transport (and core)

Packages are named host, bridge, core, sdk, or in full (mini_app_host); each brings the packages it depends on. minikit add then:

  • copies them into packages/ (or --dir), without their tests, examples and build output;
  • points the app's pubspec.yaml at the copies — only the packages you asked for become direct dependencies, and the rest of the file (comments, order) stays as it was;
  • adds packages/** to analyzer.exclude in analysis_options.yaml, since the copies' lint includes resolve only inside the toolkit;
  • records the versions and checksums in minikit.packages.json;
  • runs flutter pub get (--no-pub skips it).

Commit packages/ and minikit.packages.json with the app.

Getting newer packages

After minikit upgrade brings a newer toolkit, run the same command again:

minikit add --dry-run        # From → To for each package
minikit add                  # replace the copies with this toolkit's

With no names, it updates the framework packages the pubspec already depends on, in the folder recorded in minikit.packages.json.

Two things stop it, and --force goes ahead anyway:

  • a copy was edited after minikit wrote it (its checksum no longer matches the lock), or the folder exists but minikit did not write it — the edits would be lost;
  • the pubspec takes a framework package from somewhere else — a path into a toolkit checkout, git or a hosted server — and would be pointed at the copy instead.

Extend the framework through its extension points (a BridgeModule, a BridgeInterceptor, your own repositories) rather than editing the copies, so updates stay one command.

minikit add refuses mini-app projects: their SDK is updated by minikit upgrade --project.

Served offline by minikit docs from your toolkit checkout. Source: docs/guides/host.md.