pop method
Pops the current page from the stack and returns the result of the pop. The page's onPopPage callback will fire when this happens.
Implementation
bool pop({
final Route<dynamic>? route,
// ignore: avoid_annotating_with_dynamic
dynamic result,
PageArgs<dynamic>? pageArgs,
PageBuilder<dynamic>? pageBuilder,
}) {
//TODO: This method is pretty filthy. Clean it up.
if (_pageStack.length < 2) {
return false;
}
var pop = false;
if (route == null) {
pop = _popNullRoute(pageArgs);
} else {
pop = pageBuilder!.onPopPage(route, result, pageArgs!);
if (pop) {
pageArgs.bloc.dispose();
}
}
if (!pop) {
return false;
}
//TODO: Log the popped page
//ignore: avoid-ignoring-return-values
_pageStack.pop();
notifyListeners();
return pop;
}