Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Expose push/popRoute on FlutterViewController #6347

Merged
merged 1 commit into from
Sep 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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<FlutterPluginRegistry>)pluginRegistry;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,14 @@ - (void)setInitialRoute:(NSString*)route {
[_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 {
Expand Down