Closed
Description
b/159359456
FlutterEngine *flutterEngine =
[[FlutterEngine alloc] initWithName:@"my flutter engine"];
[[flutterEngine navigationChannel] invokeMethod:@"setInitialRoute"
arguments:@"/onboarding"];
[flutterEngine run];
This does not work. The initial route comes out as default ("/"). If I initialize view controller with project (instead of engine) and use [flutterViewController setInitialRoute], it works.
Activity
Hixie commentedon Jun 23, 2020
@chinmaygarde says this is more or less working as intended and that there is a workaround so I will reduce it to P3; he will update this bug shortly.
chinmaygarde commentedon Jul 7, 2020
@mehmetf : So, I am not sure how the initial recommendation on the page you linked was made. It is definitely inaccurate. Channel setup has always occurred when the underlying shell in the engine is setup. In the
FlutterEngine
API, the shell isn't setup till therunWithEntrypoint:libraryURI:
method is called. So, I am pretty sure[flutterEngine navigationChannel]
result isnil
. Looking back at the history, it seems to have always worked this way with the FlutterViewController being special cased to setup the shell (and it channels) upfront to specifically work around the issue of the navigation channel being unavailable. The fix is to do the same in FlutterEngine (i.e, create the shell with Settings object in the FlutterDartProject).The behavior described in the docs is a fair ask but it is a bit mystifying how that recommendation was made when the implementation has never worked that way. In any case, I see you bumped up the priority of this to P1. Is this now a blocker? My reading of the internal issue indicated that there was a workaround. I'll have reprioritize some other stuff if this is at indicated priority.
mehmetf commentedon Jul 7, 2020
FWIW, I was very surprised at that recommendation as well.
Are you referring to
initialize view controller with project instead of engine
workaround? If so, that does not work for the user since they are an add-to-app user who wants to control how/when engine is initialized.However, it is not a launch blocker for them for now so lowering priority to P2. We should, at the very least, fix documentation asap tho.
35 remaining items