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

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

仿照 Navigator.popAndPushNamed 的方法,先 pop 当前的页面,在 push 新页面。(会回调路由栈里的下一个页面的onResume和onPause方法)

Implementation

static Future<T?> popAndPushNamed<T extends Object?, TO extends Object?>(String routeName, {TO? result, Object? arguments}) {
  Navigator.pop<TO>(navigatorKey.currentContext!, result);
  return pushNamed(routeName, arguments: arguments);
}