switchTab static method

Future switchTab(
  1. String path, {
  2. Object? arguments,
  3. TransitionType transitionType = TransitionType.none,
})

Navigate to a page and clear the router stack 清空路由栈跳转,一般用于跳转首页这种情况

path The route path to navigate to. arguments Optional data to pass to the new route. transitionType Animation type for the transition (defaults to sliding from right).

Returns a Future that completes when the pushed route is popped.

Implementation

static Future<dynamic> switchTab(
  String path, {
  Object? arguments,
  TransitionType transitionType = TransitionType.none,
}) {
  return Navigator.of(HbRouter.key.currentContext!).pushNamedAndRemoveUntil(
    path,
    (_) => false,
    arguments: PageConfig(
      transitionType: transitionType,
      arguments: arguments,
    ),
  );
}