flutter的路由简单使用
跳转
Navigator.of(context)
.push(MaterialPageRoute(
builder: (context) {
return Test();
// ignore: prefer_const_constructors
},
settings: const RouteSettings(arguments: "测试"),
fullscreenDialog: true))
.then((value) => print(value));
参数接收
var title = ModalRoute.of(context)?.settings.arguments;
返回值
Navigator.of(context).pop("返回");
// 接收
Navigator.of(context)
.push(MaterialPageRoute(
builder: (context) {
return Test();
// ignore: prefer_const_constructors
},
settings: const RouteSettings(arguments: "测试"),
fullscreenDialog: true))
.then((value) => print(value));
标签:const,settings,value,arguments,context,Navigator,Flutter,路由
From: https://www.cnblogs.com/boxrice/p/16834440.html