📜  navigator push named - 任何代码示例

📅  最后修改于: 2022-03-11 14:59:22.445000             🧑  作者: Mango

代码示例2
var exampleArgument = 'example string';

Navigator.pushNamed(
    context,
    ImagesScreen.routeName,
    arguments: {'exampleArgument': exampleArgument},
);
and extract the arguments as follows:

@override
Widget build(BuildContext context) {
    final arguments = ModalRoute.of(context).settings.arguments as Map;

    if (arguments != null) print(arguments['exampleArgument']);

    return Scaffold(...);
}