Embedding multiple Flutter views in native code

218 views
Skip to first unread message

Yves Delcoigne

unread,
Dec 7, 2017, 12:00:54 PM12/7/17
to flutt...@googlegroups.com
Hello

I'm evaluating Flutter to be an option for future projects, or new features on existing projects.

I'm wondering how we can add multiple FlutterViews to our native code. Currently, I only find the example in the GitHub repository, which has a single FlutterView. This starts with the main method in main.dart, but is there a way to have multiple startup methods and choose between them?

Kind regards

Eric Seidel

unread,
Dec 7, 2017, 5:05:28 PM12/7/17
to Yves Delcoigne, flutt...@googlegroups.com
My understanding from your mail is you're asking two separate questions:

1.  Is is possible to embed multiple FlutterViews in your App.
A: Yes.  It's not a path that we've optimized for yet.  Most of our tooling (e.g. the `flutter` command line tool) expects to work with a single FlutterView (e.g which FlutterView should the tool send new code to when doing a Hot Reload?).  But it's certainly possible.  I've seen demos written with 10s or 100s of FlutterViews inside them as a stress test for example.

2.  Is it possible to start FlutterViews with different main() methods.
A: My understanding is this is possible, yes.  The exact calling apis would be different on iOS vs. Android, but the general idea is that when the FlutterView is initialized a Dart Snapshot is provided.  It should be possible to bundle multiple Snapshots (or whole .flx files) in your application and switch between them.  I don't know the exact calls off the top of my head, but they should be findable in https://docs.flutter.io/javadoc/ or https://docs.flutter.io/objcdoc/

Again, neither of these paths are particularly well paved, but both should be technically possible.  Others on this list likely know the exact details of each better than i do.

--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages