popAndPushNamed<T extends Object?, TO extends Object?> method

Future<T?> popAndPushNamed<T extends Object?, TO extends Object?>(
  1. String routeName, {
  2. TO? result,
  3. Object? arguments,
  4. String? type,
  5. BuildContext? context,
})

Implementation

Future<T?> popAndPushNamed<T extends Object?, TO extends Object?>(
    String routeName,
    {TO? result,
    Object? arguments,
    String? type,
    BuildContext? context}) {
  if (!shouldTryOpenRoute(routeName,
      context: context, type: type, arguments: arguments)) {
    return Future.value(null);
  }

  eventController.logNavigationEvent(routeName,
      arguments: arguments,
      type: type ?? MicroAppNavigationType.popAndPushNamed.name);
  if (context != null) {
    return Navigator.of(context)
        .popAndPushNamed(routeName, arguments: arguments, result: result);
  } else {
    return _nav.popAndPushNamed(routeName,
        arguments: arguments, result: result);
  }
}