[go: nahoru, domu]

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

Document best practice for developing add-to-app module integrated and standalone #7774

Open
Tracked by #5359
xster opened this issue Mar 12, 2020 · 6 comments
Open
Tracked by #5359
Labels
dev.best-practices Relates to exemplars of process, code, or writing dev.existing-apps Relates to integrating Flutter into existing apps fix.code-sample Needs new or updated code sample from.flutter-sdk Reported via move from flutter/flutter p3-low Valid but not urgent concern. Resolve when possible. Encourage upvote to surface. t.add-to-app Relates to adding Flutter components to native app t.dev-tools Relates to DevTools and CLI

Comments

@xster
Copy link
Member
xster commented Mar 12, 2020

@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 flutter/flutter#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.

@xster xster added dev.existing-apps Relates to integrating Flutter into existing apps d: examples labels Mar 12, 2020
@kf6gpe kf6gpe added the P4 label May 29, 2020
@sfshaza2
Copy link
Contributor

Is this feature available, @xster? In other words, is this only a documentation issue for flutter.dev?

@xster
Copy link
Member Author
xster commented Aug 20, 2020

SEO: wrapper, bootstrap, loader, preview, data

@xster
Copy link
Member Author
xster commented Aug 20, 2020

This is still generally the current thinking:

  1. In the most lightweight case, where the Flutter module doesn't need any bootstrap data, just flutter run in the module directory. This runs the module in a very basic ephemeral wrapper project.
  2. In a middle case where some platform-side setup is needed but where you also don't want to build and launch your full/heavy host app to test your Flutter module, create your own parallel wrapper platform app (don't modify the .ios/.android apps) to bootstrap and inject data into your Flutter module for test.
  3. For a full integration test, run the Flutter module inside your normal platform host app.

@jmagman
Copy link
Member
jmagman commented Nov 11, 2022

@atsansone why wouldn't this issue live in the website repo? https://docs.flutter.dev/development/add-to-app

@jmagman
Copy link
Member
jmagman commented Nov 11, 2022

Sorry, I misread this, I thought it was transferred from website to flutter, not the other way. Carry on. 🙂

@atsansone atsansone added from.flutter-sdk Reported via move from flutter/flutter and removed documentation labels Nov 11, 2022
@atsansone atsansone added fix.code-sample Needs new or updated code sample t.add-to-app Relates to adding Flutter components to native app dev.best-practices Relates to exemplars of process, code, or writing p3-low Valid but not urgent concern. Resolve when possible. Encourage upvote to surface. and removed d: examples labels May 30, 2023
@miquelbeltran
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev.best-practices Relates to exemplars of process, code, or writing dev.existing-apps Relates to integrating Flutter into existing apps fix.code-sample Needs new or updated code sample from.flutter-sdk Reported via move from flutter/flutter p3-low Valid but not urgent concern. Resolve when possible. Encourage upvote to surface. t.add-to-app Relates to adding Flutter components to native app t.dev-tools Relates to DevTools and CLI
Projects
None yet
Development

No branches or pull requests

8 participants