openPage<T> method

  1. @override
Future<T?>? openPage<T>(
  1. BuildContext context,
  2. String pageName, {
  3. RoutePushType pushType = RoutePushType.pushNamed,
  4. Map? arguments,
  5. RoutePredicate? predicate,
})
override

open page

Implementation

@override
Future<T?>? openPage<T>(BuildContext context, String pageName,
    {RoutePushType pushType = RoutePushType.pushNamed,
    Map<dynamic, dynamic>? arguments,
    RoutePredicate? predicate}) {
  if (!_routeInterceptorTable.containsKey(pageName)) {
    return super.openPage(
      context,
      pageName,
      pushType: pushType,
      arguments: arguments,
      predicate: predicate,
    );
  }
  MixinRouteInterceptor interceptor = _routeInterceptorTable[pageName]!;
  bool needIntercept = interceptor.call(
    context,
    pageName,
    pushType,
    arguments: arguments,
    predicate: predicate,
  );
  if (needIntercept) {
    return Future.value(null);
  } else {
    return super.openPage(
      context,
      pageName,
      pushType: pushType,
      arguments: arguments,
      predicate: predicate,
    );
  }
}