didPushRouteInformation method
- @override
- @mustCallSuper
- RouteInformation routeInformation
inherited
Called when the host tells the application to push a new RouteInformation and a restoration state onto the router.
Observers are expected to return true if they were able to handle the notification. Observers are notified in registration order until one returns true.
This method exposes the pushRouteInformation
notification from
SystemChannels.navigation.
Implementation
// ignore: comment_references
/// [SystemChannels.navigation].
///
@override
@mustCallSuper
Future<bool> didPushRouteInformation(
RouteInformation routeInformation) async {
// Don't if the State object is defunct.
if (!mounted) {
return false;
}
/// No 'setState()' functions are allowed to fully function at this point.
_setStateAllowed = false;
for (final con in controllerList) {
await con.didPushRouteInformation(routeInformation);
}
_setStateAllowed = true;
if (_setStateRequested) {
_setStateRequested = false;
// Only the latest State is rebuilt
if (isLastState) {
/// Perform a 'rebuild' if requested.
setState(() {});
}
}
// Record the triggered event
assert(() {
if (_printEvents) {
debugPrint('============ Event: didPushRouteInformation() in $this');
}
return true;
}());
return super.didPushRouteInformation(routeInformation);
}