The Application Bundle

The application bundle created using the flutter build ios --release command (or using your IDE) looks remarkably similar to a typical iOS app bundle that contains the application executable along with any referenced frameworks and resources.

Flutter’s generated bundle for the Runner app:

Runner.app

├── AppFrameworkInfo.plist

├── Assets.car

├── Base.lproj

│ ├── LaunchScreen.storyboardc

│ └── Main.storyboardc

├── Debug.xcconfig

├── Frameworks

│ ├── App.framework # See “App framework bundle”

│ │ ├── App

│ │ ├── Info.plist

│ └── Flutter.framework # See “Flutter framework bundle”

│ ├── Flutter

│ ├── Info.plist

│ └── icudtl.dat

├── Info.plist

├── Runner

└── flutter_assets

├── AssetManifest.json

├── FontManifest.json

├── LICENSE

├── fonts

└── packages

└── cupertino_icons

└── assets

└── CupertinoIcons.ttf

Compiling the Application

When compiling a release mode version of the app (as opposed to profile or debug modes), artifacts from both the buildbots and your host machine are needed. (For more information on the buildbots, part of the engine build that uses GN and Ninja , see Contributing to the Flutter engine.)

When you install the SDK, Flutter tools are cached on your machine. You can see them by looking inside the bin/cache directory in your copy of the Flutter SDK. If you decide to integrate any steps of this process into your own build system, this directory contains all the versioned tools you need for working with Flutter.

The following sections describe some of the files unique to Flutter’s iOS app bundles.

Flutter Engine framework bundle

The Flutter.framework directory, packaged as an iOS framework bundle, includes:

Flutter engine

Contains the core libraries (for example, graphics, file and network I/O, accessibility support, plugin architecture), the DartVM, and the Skia renderer.

Contains the core libraries (for example, graphics, file and network I/O, accessibility support, plugin architecture), the DartVM, and the Skia renderer. Assets referenced by the Flutter engine

This currently is just ICU data.

The buildbots generate the Flutter engine framework bundle, and the Flutter tools download and cache it on your machine.

AOT framework bundle

The App.framework bundle contains an AOT snapshot of all the Dart application code written by the user, as well as the Dart code for the Flutter framework and plugins, in armv7s and aarch64 formats.

During a release build, the compiler performs tree-shaking on the Dart code, so only the code that is actually used ends up in the bundle. The gen_snapshot tool cached on your machine generates the artifacts necessary to create the App.framework bundle.

AOT Snapshot

The AOT snapshot library contains the ahead-of-time code compiled from Dart to machine native bits.

The snapshot library, generated by gen_snapshot , contains four main symbols. These symbols can be dumped by the nm command. For example:

$ nm -gU Runner.app/Frameworks/App.framework/App

Runner.app/Frameworks/App.framework/App (for architecture armv7):

003c6f60 S _kDartIsolateSnapshotData

00007000 T _kDartIsolateSnapshotInstructions

003c16a0 S _kDartVmSnapshotData

00004000 T _kDartVmSnapshotInstructions Runner.app/Frameworks/App.framework/App (for architecture arm64):

00000000004041a0 S _kDartIsolateSnapshotData

0000000000009000 T _kDartIsolateSnapshotInstructions

00000000003fc740 S _kDartVmSnapshotData

0000000000005000 T _kDartVmSnapshotInstructions

Their purpose is as follows:

Dart VM Snapshot ( kDartVmSnapshotData ):

Represents the initial state of the Dart heap shared between isolates. This helps launch Dart isolates faster, but doesn’t contain any isolate-specific information.

): Represents the initial state of the Dart heap shared between isolates. This helps launch Dart isolates faster, but doesn’t contain any isolate-specific information. Dart VM Instructions ( kDartVmSnapshotInstructions ):

Contains AOT instructions for common routines shared between all Dart isolates in the VM. This snapshot is typically extremely small and mostly contains stubs.

): Contains AOT instructions for common routines shared between all Dart isolates in the VM. This snapshot is typically extremely small and mostly contains stubs. Isolate Snapshot ( kDartIsolateSnapshotData ):

Represents the initial state of the Dart heap and includes isolate-specific information.

): Represents the initial state of the Dart heap and includes isolate-specific information. Isolate Instructions ( kDartIsolateSnapshotInstructions ):

Contains the AOT code that is executed by the Dart isolate.

Invoking gen_snapshot is simple. You point it to the Dart source code, and it spits out a blob for each of these four symbols. Then, Xcode packages the symbols into an iOS framework bundle just like it would for a framework written in C, C++, Objective-C or Swift.

Learn more about how to configure the snapshot and the engine in the Flutter engine wiki.