API reference
The public Kotlin and Swift surface of the loader, and the flitz { } Gradle block.
The loader's surface is deliberately small. Everything not listed here is
internal to the AAR or the xcframework and is not part of the contract.
Configuration that would otherwise live in a configure(...) call is derived
from your build instead: the available-plugins list from
.flutter-plugins-dependencies, and the expected platform_dill_hash values
from your Flitz SDK (see Compatibility).
Kotlin
Package pl.leancode.flitz.loader, from pl.leancode.flitz:loader-android.
package pl.leancode.flitz.loader
// Acquisition entry point. Hosts the permission gate → QR scanner → HTTPS
// download → error UI sequence and starts BundleRunnerActivity once a bundle
// is acquired. Registered in the AAR manifest (exported, singleTask) with the
// deeplink intent filter, which the manifest merger adds to every active
// flavor's APK.
public open class BundleLoaderActivity : AppCompatActivity
// Hosts the bundle's Flutter engine and FlutterView. Registered in the AAR
// manifest with no intent filter. Not launched directly — BundleLoaderActivity
// starts it after a bundle passes validation, and its onDestroy tears the
// engine down and removes the extracted files.
public open class BundleRunnerActivity : AppCompatActivityYou do not subclass or launch either activity yourself. You interact with the
Android loader through the Gradle plugin: apply it, list flavors in
flitz { enabledFlavors }, and optionally add the MAIN/LAUNCHER override
described in the Android quickstart.
The flitz { } Gradle block
Registered by the pl.leancode.flitz.loader Gradle plugin on the app module.
Prop
Type
For each active variant the plugin adds pl.leancode.flitz:loader-android at
its own version to <variant>Implementation, sets the flitzUrlScheme
placeholder, and registers flitzGenerateAvailablePlugins<Variant> and
flitzGenerateHostConfig<Variant>, whose outputs land in the APK as
assets/flitz_loader_available_plugins.json and
assets/flitz_loader_host_config.json.
Swift
Module FlitzLoader, from FlitzLoader.xcframework (iOS 16.0+, arm64).
public enum BundleLoader {
// Ready-made acquisition view controller: permission gate → QR scanner →
// HTTPS download → runner, end to end. Install it as your scene's
// window.rootViewController for the scanner-as-first-screen mode.
public static func scannerViewController() -> UIViewController
}
// Drop-in app delegate base class; subclass this instead of FlutterAppDelegate.
// Routes acquisition URLs received via application(_:open:options:) and
// presents the loader UI modally over your root view controller.
open class BundleLoaderAppDelegate: FlutterAppDelegate {
// Called once per bundle engine, before the engine runs. Default: no-op.
// Override and call GeneratedPluginRegistrant.register(with: engine).
@objc open func registerPlugins(with engine: FlutterEngine)
}
// Drop-in scene delegate base class for UIScene apps. Routes acquisition URLs
// received via scene(_:openURLContexts:) and at launch, forwards the bundle's
// own deeplinks to the running bundle engine, and replays the captured scene
// connection into that engine once it exists.
open class BundleLoaderSceneDelegate: FlutterSceneDelegateNotes:
registerPlugins(with:)is the only hook you must implement. The loader cannot referenceGeneratedPluginRegistrant(it is generated in your project). Without the override, bundles run with no plugins and method-channel calls fail withMissingPluginException.BundleLoaderSceneDelegatedoes not install a root view controller; your scene delegate orInfo.pliststill configures the app's initial UI. When you overridescene(_:willConnectTo:options:), callsuperfirst.- Both delegates claim a URL only when its authority is
runordownload; any other URL falls through to your own open-URL handling. See the URL scheme. - Plugins that rely on
FlutterPluginRegistrar.addApplicationDelegate(_:)may not work inside bundles: the bundle engine's registrar is invoked outside the standard app-delegate forwarding chain.