removeRoute method
Removes the provided route
from the navigator and returns true if
it is successfully removed, or false if not found.
If the route is removed successfully, it will trigger Route.didPop.
route
represents the removed Route, and result
signifies the result passed as an argument to Route.didPop.
Implementation
bool removeRoute(Route<dynamic> route, dynamic result) {
_pageInstances.remove(route.settings);
_pageInstanceToTypeMap.remove(route.settings);
_pageInstanceToRouteData.remove(route.settings);
if (route.settings is StandardPageInterface) {
final tState = (route.settings as StandardPageInterface)
.standardPageKey
.currentState;
final tCompleter = _pageInstanceCompleterMap.remove(route.settings);
if (tCompleter != null) {
tState?._completeResult(tCompleter, result);
}
tState?._updateActiveStatus(false);
}
_updatePages();
if (route.didPop(result)) {
return true;
}
return false;
}