-
Notifications
You must be signed in to change notification settings - Fork 29.3k
Closed
Labels
a: existing-appsIntegration with existing apps via the add-to-app flowIntegration with existing apps via the add-to-app flowdependency: dartDart team may need to help usDart team may need to help usplatform-androidAndroid applications specificallyAndroid applications specificallyplatform-iosiOS applications specificallyiOS applications specifically
Description
This is important for projects who want to integrate Flutter into their existing apps. There's currently no reasonable way to treat FlutterView
like a regular Android view:
- It does not support different endpoints in Dart. You can specify different endpoints via runFromBundle but if you expose multiple entry points in Dart, the AOT compiler tree-shakes them.
- There's no easy way of passing parameters to Dart the way you would pass parameters between Android activities via an Intent. The expected way right now is for the Dart app to run and register callbacks that are tied to a PlatformChannel and then the Android shell calls that channel. This works fine for standalone Flutter apps but for a small Flutter activity integrated into a larger Android app, it is a pain.
If we support parameters in runFromBundle, we could do something like this on Dart:
void main([List<String> args]) {
if (args?.length != 1) return;
switch (args[1]) {
case 'page1':
runApp(new Page1());
break;
case 'page2':
runApp(new Page2());
break;
}
}
Ideally the params can be passed further down the app and the app can decide how to route pages but you get the idea.
I assume the same thing will be a problem in iOS as well.
tdesc, pj0579 and nguyendhoan
Metadata
Metadata
Assignees
Labels
a: existing-appsIntegration with existing apps via the add-to-app flowIntegration with existing apps via the add-to-app flowdependency: dartDart team may need to help usDart team may need to help usplatform-androidAndroid applications specificallyAndroid applications specificallyplatform-iosiOS applications specificallyiOS applications specifically