Description
This meta issue proposes an array of improvements to Flutter for supporting customers who want to use multiple Flutter instances in an app, focused on the Add-to-app use case. It includes improvements for performance and ease-of-use.
Design doc
http://flutter.dev/go/multiple-engines
Phase 1
Share Engine Components
iOS
- API - iOS - Shared Engine Components API - iOS - Lightweight Flutter Engines #72010
- Threads - iOS - iOS: Share engine thread hosts between multiple engines #72019
- Skia Contexts - iOS - iOS: Share Skia context between multiple engines #72021
- GPU Contexts - iOS - iOS: Share GPU contexts between lightweight engines #72022
Android
- API - Android - Shared Engine Components API for Android #72018
- Threads - Android - Android: Share engine thread hosts between multiple engines #72528
- Skia Contexts - Android - Android: Share Skia context between multiple engines #73597
- GPU Contexts - Android - Android: Share GPU contexts between lightweight engines #73599
Shared
- Fonts - Share font collections between multiple engines #72024
- Spawn -> Kill Spawner Integration test - Spawn -> Kill Integration Test #72319
- Documentation - Document the recommended way of producing multiple embedded Flutter UI / navigation states #37644
- Sample Code - Multiple Flutters Sample Code #74530 (written, not landed, waiting for API to hit stable)
- Handle thread merging (Crashing) - Handle thread merging (platform views) with engines that shared components #73620
Phase 2
Share Engine Components
- IsolateGroups - Use Dart's lightweight isolates between multiple engines #72025
More performance tightening
- Squeeze an extraneous 0.1MB per engine from Android embedding - Improve multiple Flutters Android embedding memory performance #74941
- Squeeze an extraneous 0.32MB per engine from Dart VM - Improve multiple Flutters Android dart VM memory performance #74942
FlutterView / FlutterEngine integration
- Android FlutterView ergonomics- Make integration via Android FlutterView easier website#7785
Tests
- Shared engine memory benchmark - Create multi-engine memory benchmark #72026
- Spawn->Kill Integration test for Android - Spawn->Kill Integration test for Android #72527
Cleanup
- Refactor Spawn-> Kill integration test - Refactor Spawn->Kill Integration test to be more independent #72525
- Handle thread merging (platform views) - Handle thread merging (platform views) with engines that shared components #73620
- InitialRoute missing in the API - FlutterEngineGroup does not support initialRoute #78931
Phase 3
- Async VM and Shell creation - Asynchronous Shell and VM creation #72028
- Easier engine↔engine interop - Easier FlutterEngine↔FlutterEngine interop #33288
- Signal garbage collection only when all isolates are idle - Garbage collect only when all isolates are idle #72031
- Cleanup non-visible view surfaces
- Shared image cache - Share image cache between multiple engines #72033
- Consider separate UI threads per engine
- Create lightweight engines from existing FlutterEngineGroup in FlutterActivity/FlutterViewController - Let FlutterEngineGroup be passed in proxy engine constructors in FlutterViewController/FlutterActivity #72742