didPushRoute method
- @override
- @mustCallSuper
- @Deprecated('Use didPushRouteInformation instead. ' 'This feature was deprecated after v3.8.0-14.0.pre.')
- String route
inherited
Called when the host tells the app to push a new route onto the navigator.
Implementation
@override
@mustCallSuper
@Deprecated('Use didPushRouteInformation instead. '
'This feature was deprecated after v3.8.0-14.0.pre.')
Future<bool> didPushRoute(String route) async {
/// 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 `pushRoute` notification from
// Don't if the State object is defunct.
if (!mounted) {
return true;
}
/// No 'setState()' functions are allowed to fully function at this point.
_setStateAllowed = false;
/// Set if a StateXController successfully 'handles' the notification.
bool handled = false;
for (final con in controllerList) {
final didPush = await con.didPushRoute(route);
if (didPush) {
handled = true;
}
}
_setStateAllowed = true;
if (_setStateRequested) {
_setStateRequested = false;
// Only the latest State is rebuilt
if (isLastState) {
/// Perform a 'rebuild' if requested.
setState(() {});
}
}
return handled;
}