Open xster opened 4 years ago
Is this feature available, @xster? In other words, is this only a documentation issue for flutter.dev?
SEO: wrapper, bootstrap, loader, preview, data
This is still generally the current thinking:
flutter run
in the module directory. This runs the module in a very basic ephemeral wrapper project.@atsansone why wouldn't this issue live in the website repo? https://docs.flutter.dev/development/add-to-app
Sorry, I misread this, I thought it was transferred from website to flutter, not the other way. Carry on. 🙂
Hi all, to me, it looks like that https://docs.flutter.dev/add-to-app and the samples in https://github.com/flutter/samples/tree/main/add_to_app contain examples of this usecase.
You can use the Entry point annotation as explained here: https://docs.flutter.dev/add-to-app/ios/add-flutter-screen#dart-entrypoint to have a different entry point for your Flutter module when you run the module embedded intro a native app, while still running the default main()
method as entry point when running it standalone.
Another alternative is running the module with a different route from the native app than when running standalone. You would use setInitialRoute
from the native app as described here: https://docs.flutter.dev/add-to-app/android/add-flutter-screen#initial-route-with-a-cached-engine for example /mini
, while for example the default route when standalone would be /
.
Do you think this would be enough? Or a more specific explanation is still missing?
@blasten called this out last year. This was also extensively worked on by our China customers https://www.infoq.cn/article/iYGyKQowuiUN_Gi2hHDo.
For lightweight "detached" development, it makes sense for Flutter module developers to be able to bootstrap their module and launch/test their module both in a standalone fashion and also in normal 'production' mode integrated into their bigger host app.
Document the best practices for this approach.
Relates to https://github.com/flutter/flutter/issues/32989 and http://flutter.dev/go/everything-builds-from-a-module as well.
I'm of the opinion that the standalone run shell should be another (albeit simpler) add-to-app host app that wraps the same Flutter module and that supplies it with upstream dependencies, data etc.