-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Closed
flutter/engine
#29096Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecta: existing-appsIntegration with existing apps via the add-to-app flowIntegration with existing apps via the add-to-app flowc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilitycustomer: alibabaengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.platform-androidAndroid applications specificallyAndroid applications specificallyplatform-iosiOS applications specificallyiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
FlutterEngineGroup already supports initialRoute, but in the add to app scenario, structured arguments transfer is also very necessary for users.
design doc: https://docs.google.com/document/d/1ufsbXdhCm1qTAY2eXsRrVrfxED5WCZgqQ-Tm2LzScoE/edit
I want to add a new parameter named initialArguments to pass the startup arguments from platform to Flutter app.
Usage may look like this:
Android:
Map initialArguments = new HashMap();
intialArguments.put("color", "yellow");
List<String> dartEntrypointArgs = convertToDartEntrypointArgs(intialArguments);
FlutterEngine engine = engineGroup.createAndRunEngine(activity, dartEntrypoint, initialRoute, dartEntrypointArgs);iOS:
NSDictionary *initialArguments = @{@"color" : @"yellow"};
NSArray *entrypointArgs = convertToDartEntrypointArgs(initialArguments);
FlutterEngine *engine = [engineGroup makeEngineWithEntrypoint:entrypoint
libraryURI:libraryURI
initialRoute:initialRoute
entrypointArgs:entrypointArgs];Dart
void main(List<String> rawArgs) {
dynamic arguments = convertEntrypointArgsToMap(rawArgs);
String color = arguments['color'];
......
}Related Issue
This Issue is similar to the following two, but focuses more on FlutterEngineGroup
#23786
#34170
When there is no FlutterEngineGroup, initialArguments can also be passed to the Flutter app in the following way
Android
engine.getDartExecutor().executeDartEntrypoint(dartEntrypoint, dartEntrypointArgs);iOS
[engine runWithEntrypoint:entrypoint
libraryURI:libraryURI
initialRoute:initialRoute
entrypointArgs:entrypointArgs];/cc @gaaclarke @xster
Any thoughts about this?
luckysmgluckysmg
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecta: existing-appsIntegration with existing apps via the add-to-app flowIntegration with existing apps via the add-to-app flowc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilitycustomer: alibabaengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.platform-androidAndroid applications specificallyAndroid applications specificallyplatform-iosiOS applications specificallyiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version