Navigation
How do I navigate between pages?
In iOS, to travel between view controllers, you can use a UINavigationController that manages the stack of view controllers to display.
Flutter has a similar implementation, using a Navigator and Routes. A Route is an abstraction for a “screen” or “page” of an app, and a Navigator is a widget that manages routes. A route roughly maps to a UIViewController. The navigator works in a similar way to the iOS UINavigationController, in that it can push() and pop() routes depending on whether you want to navigate to, or back from, a view.
To navigate between pages, you have a couple options:
The following example builds a Map.
void main() {
runApp(CupertinoApp(
home: MyAppHome(), // becomes the route named '/'
routes: <String, WidgetBuilder> {
'/a': (BuildContext context) => MyPage(title: 'page A'),
'/b': (BuildContext context) => MyPage(title: 'page B'),
'/c': (BuildContext context) => MyPage(title: 'page C'),
},
));
}
Navigate to a route by pushing its name to the Navigator.
Navigator.of(context).pushNamed('/b');
The Navigator class handles routing in Flutter and is used to get a result back from a route that you have pushed on the stack. This is done by awaiting on the Future returned by push().
For example, to start a ‘location’ route that lets the user select their location, you might do the following:
Map coordinates = await Navigator.of(context).pushNamed('/location');
And then, inside your ‘location’ route, once the user has selected their location, pop() the stack with the result:
Navigator.of(context).pop({"lat":43.821757,"long":-79.226392});
How do I navigate to another app?
In iOS, to send the user to another application, you use a specific URL scheme. For the system level apps, the scheme depends on the app. To implement this functionality in Flutter, create a native platform integration, or use an existing plugin, such as url_launcher.
How do I pop back to the iOS native viewcontroller?
Calling SystemNavigator.pop() from your Dart code invokes the following iOS code:
UIViewController* viewController = [UIApplication sharedApplication].keyWindow.rootViewController;
if ([viewController isKindOfClass:[UINavigationController class
Semantic portal