flutter_global_navigator

Flutter中实现无Context跳转

Get Start

初始化配置

main.dart 中配置 navigatorKey 参数

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      navigatorKey: MopNavigator.navigatorKey,
    );
  }
}

使用方式

Navigator 调用方式一致

MopNavigator.pushName('/jumpRoute');

Libraries

flutter_global_navigator