flutter / website

Flutter documentation web site
https://docs.flutter.dev
Other
2.8k stars 3.21k forks source link

Add tutorial on sharing data between Android/iOS and embedded Flutter #9363

Open eseidel opened 1 year ago

eseidel commented 1 year ago

Is there an existing issue for this?

Use case

Users often come to us (Shorebird) and previously me in my role as Flutter director, confused as to how to share data between their add-to-app Flutter and their existing app.

Proposal

There appears to be an old example on this, "books": https://github.com/flutter/samples/tree/master_archived/add_to_app

But I don't see something similar in the modern examples: https://github.com/flutter/samples/

There is a whole guide on adding a little Android to your Flutter: https://docs.flutter.dev/platform-integration/platform-channels

But there is no mention of going the other way. Even in the add-to-app tutorial: The closest we get is: https://docs.flutter.dev/add-to-app/android/plugin-setup

The basic question is "I have some data in my Android app, I'm adding a Flutter screen, how do I share data with that screen". Given that all of the top most used Flutter apps are add-to-app (or were last I knew) this feels worth documenting. :)

Then again, given the presence of the (archived) "books" sample, maybe I'm just looking in the wrong place?

FYI @RedBrogdon

Thank you!

eseidel commented 1 year ago

There are various third parties who have tried: https://blog.devgenius.io/use-flutter-screens-in-native-android-app-share-data-among-them-d97d670807a6 https://tanya-anand.medium.com/data-pass-between-flutter-and-android-using-the-method-channel-f0e8f7655fe

Even just picking one and linking to it, would probably be worth it, given that (at least in my experience) (especially "late majority") users tend to expect things from the official sources. 🤷

mohit9923 commented 1 year ago

So the problem is:

Here, it is asking me to open Android folder inside the Flutter app, whereas my use case is to perform these android specific data-sending changes in my own existing native Android app, from where I am opening Flutter project on a button click image

huycozy commented 1 year ago

Hi @eseidel I see the books sample here at https://github.com/flutter/samples/tree/main/add_to_app/books (not archived url) and I also can't find an existing tutorial/guideline for this on website.

But I wonder if this should be transferred to website repository? (as in the end, the tutorial will be published to the website and the team there will take care of this)

eseidel commented 1 year ago

Please feel free to transfer wherever is appropriate. I recall we used to keep all bugs in one single repo, but please use whatever the modern patterns are. :)

huycozy commented 1 year ago

Thanks for the response. Transferring this issue to website repo.

atsansone commented 1 year ago

@leighajarett : Do we have anything in the pipeline for this?

leighajarett commented 1 year ago

I don't specifically but I'm sure we can adapt the app extension stuff because its a similar mechanism https://docs.flutter.dev/platform-integration/ios/app-extensions

eseidel commented 1 year ago

Thanks for the consideration. My interest here is simply in aligning what is documented with the frequency of the user journey. From my experience (at least since leaving Google) most customers are adding a little Flutter to some existing app, the fact that that "golden path" (at least the data sharing portion) isn't documented was surprising/concerning. (We actually commonly get outreach from customers who are considering moving their native app to Flutter now that code push is a possibility.)

Obviously you should validate with your own experience/numbers, it's possible the subset of customers we talk to at Shorebird is different from those the Google team is in contact with. 🤷

leighajarett commented 1 year ago

Yeah totally. Thanks for the feedback, @eseidel!

Happy to help you with this, @atsansone. But I don't think I have the bandwidth to write myself in the next few weeks

atsansone commented 1 year ago

@leighajarett : I'll set up a meet soon. Thanks!