navigation constant Null safety
A JSON MethodChannel for navigation.
The following incoming methods are defined for this channel (registered using MethodChannel.setMethodCallHandler):
-
popRoute
, which is called when the system wants the current route to be removed (e.g. if the user hits a system-level back button). -
pushRoute
, which is called with a single string argument when the operating system instructs the application to open a particular page. -
pushRouteInformation
, which is called with a map, which contains a location string and a state object, when the operating system instructs the application to open a particular page. These parameters are stored under the keylocation
andstate
in the map.
The following methods are used for the opposite direction data flow. The framework notifies the engine about the route changes.
-
selectSingleEntryHistory
, which enables a single-entry history mode. -
selectMultiEntryHistory
, which enables a multiple-entry history mode. -
routeInformationUpdated
, which is called when the application navigates to a new location, and which takes two arguments,location
(a URL) andstate
(an object). -
routeUpdated
, a deprecated API which can be called in the same situations asrouteInformationUpdated
but whose arguments arerouteName
(a URL) andpreviousRouteName
(which is ignored).
These APIs are exposed by the SystemNavigator class.
See also:
- WidgetsBindingObserver.didPopRoute and WidgetsBindingObserver.didPushRoute, which expose this channel's methods.
- Navigator which manages transitions from one page to another. Navigator.push, Navigator.pushReplacement, Navigator.pop and Navigator.replace, utilize this channel's methods to send route change information from framework to engine.
Implementation
static const MethodChannel navigation = OptionalMethodChannel(
'flutter/navigation',
JSONMethodCodec(),
);