-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Description
Previously, it was required in some use cases to create multiple flutter engines that didn't share resources because dart isolate groups didn't exist and platform channels were unable to be used from background isolates. Now that both are possible via FlutterEngineGroup APIs and Isolate Platform Channels; we should deprecate the use of generating a second isolate group. Doing so can result in: unexpected behaviors from Dart (ex #113825), worse performance and there is no known reason why it should be done.
That means that anytime someone creates a new dart isolate group when there is one already in existence it should result in a loud warning in the terminal (since there is currently no way to block it at build time). We should also add a deprecation warning on FlutterEngine's constructor, encouraging usage of FlutterEngineGroup instead. Also, Android and iOS apps should use FlutterEngineGroups by default. Lastly, we should guarantee that users don't accidentally create multiple FlutterEngineGroups. The easiest way to make that guarantee is to convert FlutterEngineGroup to singletons and to deprecate their constructors as well.
In summary, the suggested fixes are:
- Print out error message when creating second live dart isolate group
- Deprecate FlutterEngine constructor
- Start using FlutterEngineGroup by default
- Deprecate public FlutterEngineGroup constructors
- Make FlutterEngineGroup singletons