Skip to content

Make starting up a second isolate group deprecated #115507

@gaaclarke

Description

@gaaclarke

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:

  1. Print out error message when creating second live dart isolate group
  2. Deprecate FlutterEngine constructor
  3. Start using FlutterEngineGroup by default
  4. Deprecate public FlutterEngineGroup constructors
  5. Make FlutterEngineGroup singletons

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: proposalA detailed proposal for a change to Flutterengineflutter/engine related. See also e: labels.team-engineOwned by Engine teamtriaged-engineTriaged by Engine team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions