diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h b/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h index e640bb7a8a65bf4733151a01530091998063fd1a..2e8b02d05195fb88ccd2135c17ab3345c2876df5 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h @@ -46,11 +46,29 @@ FLUTTER_EXPORT /** Sets the first route that the Flutter app shows. The default is "/". + This method will guarnatee that the initial route is delivered, even if the + Flutter window hasn't been created yet when called. It cannot be used to update + the current route being shown in a visible FlutterViewController (see pushRoute + and popRoute). - Parameter route: The name of the first route to show. */ - (void)setInitialRoute:(NSString*)route; +/** + Instructs the Flutter Navigator (if any) to go back. + */ +- (void)popRoute; + +/** + Instructs the Flutter Navigator (if any) to push a route on to the navigation + stack. The setInitialRoute method should be prefered if this is called before the + FlutterViewController has come into view. + + - Parameter route: The name of the route to push to the navigation stack. + */ +- (void)pushRoute:(NSString*)route; + - (id)pluginRegistry; /** diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index efda071b088b27723adabdadfc8475bcbf89a1c5..74b8b9455892a0ca97228272c0612b782d2f42f9 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -315,6 +315,14 @@ [_navigationChannel.get() invokeMethod:@"setInitialRoute" arguments:route]; } +- (void)popRoute { + [_navigationChannel.get() invokeMethod:@"popRoute" arguments:nil]; +} + +- (void)pushRoute:(NSString*)route { + [_navigationChannel.get() invokeMethod:@"pushRoute" arguments:route]; +} + #pragma mark - Loading the view - (void)loadView {