-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Description
Use case
The basic Flutter API supports running engine from a custom Dart entry point, this is implemented in the FlutterProjectArgs structure (custom_dart_entrypoint).
Android, Windows, macOS, and iOS implement this capability in the platform API. For example, Windows has a FlutterWindowsEngine::RunWithEntrypoint method. Android has a DartExecutor class that allows you to run the Flutter Engine using a custom callback dispatcher as an entry point.
The presence of this feature made it possible to implement the workmanager package, which allows executing Dart code in the background, in a duplicated main Isolate. Without the ability to set a custom entry point, it's impossible to implement this feature in Linux.
Proposal
Add a new fl_engine_start_with_entrypoint() method to fl_engine, or add the dart_entrypoint field to the _FlDartProject structure and the corresponding fl_dart_project_set_dart_entrypoint() method.
I think that the implementation will not be difficult, because it's enough to pass the entry point argument to FlutterProjectArgs structure.