Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support dart entrypoint #111

Closed
xiaowei-guan opened this issue Jun 10, 2021 · 9 comments · Fixed by flutter-tizen/flutter-tizen#171
Closed

Support dart entrypoint #111

xiaowei-guan opened this issue Jun 10, 2021 · 9 comments · Fixed by flutter-tizen/flutter-tizen#171
Assignees
Labels
enhancement New feature or request

Comments

@xiaowei-guan
Copy link

xiaowei-guan commented Jun 10, 2021

Typically, a Flutter app begins execution at the Dart method called main(), however this is not required. Developers can specify a different Dart entrypoint

@xiaowei-guan xiaowei-guan self-assigned this Jun 10, 2021
@swift-kim
Copy link
Member

The plugin build system (https://github.com/flutter-tizen/flutter-tizen/blob/20007aa24f83ff21ff3f5314410f16e448b0d75c/lib/tizen_plugins.dart#L194) should be a current blocker for this. I'll check if there's any way to work around if you give me some example of how to test this. (You're not referring to named routes, right?)

@swift-kim
Copy link
Member

For those who are interested:

Custom entry points can be specified in Dart code using @pragma("vm:entry-point"): https://github.com/dart-lang/sdk/blob/master/runtime/docs/compiler/aot/entry_point_pragma.md

The Android embedder supports starting an engine from a custom entry point:

if (dartEntrypoint == null) {
  dartEntrypoint = DartEntrypoint.createDefault(); // main()
}

if (activeEngines.size() == 0) {
  engine = createEngine(context);
  engine.getDartExecutor().executeDartEntrypoint(dartEntrypoint);
} else {
  engine = activeEngines.get(0).spawn(context, dartEntrypoint);
}

What you are trying to do is to set different entry points for spawned engine instances, right?

If so, there's another approach to achieve a similar goal without creating multiple entry points by using Navigator. However, it will result in additional complexity as described here:

Developers who would like to use the same FlutterEngine between different Activitys and Fragments and switch the route between those displays need to setup a method channel and explicitly instruct their Dart code to change Navigator routes.

@bwikbs
Copy link
Member

bwikbs commented Jun 11, 2021

@xiaowei-guan
Is the purpose of this preparation for the FlutterEngineGroup API? If so, thanks! 😄

@xiaowei-guan
Copy link
Author

xiaowei-guan commented Jun 11, 2021

For those who are interested:

Custom entry points can be specified in Dart code using @pragma("vm:entry-point"): https://github.com/dart-lang/sdk/blob/master/runtime/docs/compiler/aot/entry_point_pragma.md

The Android embedder supports starting an engine from a custom entry point:

if (dartEntrypoint == null) {
  dartEntrypoint = DartEntrypoint.createDefault(); // main()
}

if (activeEngines.size() == 0) {
  engine = createEngine(context);
  engine.getDartExecutor().executeDartEntrypoint(dartEntrypoint);
} else {
  engine = activeEngines.get(0).spawn(context, dartEntrypoint);
}

What you are trying to do is to set different entry points for spawned engine instances, right?

If so, there's another approach to achieve a similar goal without creating multiple entry points by using Navigator. However, it will result in additional complexity as described here:

Developers who would like to use the same FlutterEngine between different Activitys and Fragments and switch the route between those displays need to setup a method channel and explicitly instruct their Dart code to change Navigator routes.

Yes, we try set entry point for flutter engine on Tizen.

FlutterProjectArgs args = {};
args.custom_dart_entrypoint = 

I tested it today, if we set custom_dart_entrypoint , we can run this entrypoint successful.

@swift-kim swift-kim added the enhancement New feature or request label Jun 11, 2021
@xiaowei-guan
Copy link
Author

@xiaowei-guan
Is the purpose of this preparation for the FlutterEngineGroup API? If so, thanks! 😄
we

@xiaowei-guan
Is the purpose of this preparation for the FlutterEngineGroup API? If so, thanks! 😄

we add this for multiple screen based on EOM, run two engines, not share memeory.
and I find if we want implement FlutterEngineGroup, Entrypoint is required.

@swift-kim
Copy link
Member

This feature may be needed by flutter-tizen/flutter-tizen#143.

Maybe we can implement this when #133 is merged (to avoid conflicts).

@xiaowei-guan
Copy link
Author

Dart entrypoint for engine(xiaowei-guan@163bb68)

@swift-kim
Copy link
Member

Implemented by #149.

@swift-kim
Copy link
Member

We need to update the tool side as well in order to be able to use this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants