offNamedUntil method
Future<T?> ?
offNamedUntil(
- String page, {
- bool predicate(
- GetPage<
T> route
- GetPage<
- Object? arguments,
- String? id,
- Map<
String, String> ? parameters,
override
Navigates off a named page until a certain condition is met and returns a result of type T
.
Implementation
@override
Future<T?>? offNamedUntil(
String page, {
bool Function(GetPage<T> route)? predicate,
Object? arguments,
String? id,
Map<String, String>? parameters,
}) async {
final PageSettings args = _buildPageSettings(page, arguments);
final RouteDecoder<T>? route = _getRouteDecoder(args);
if (route == null) {
return null;
}
final bool Function(GetPage<T> route) newPredicate =
predicate ?? (GetPage<T> route) => false;
while (_activePages.length > 1 &&
newPredicate(_activePages.last.route! as GetPage<T>)) {
_activePages.removeLast();
}
return _replaceNamed(route);
}