Answers for "navigator push named"

1

material app routes

///////////////////////////////////////
// Setting up routes on material app //
///////////////////////////////////////

MaterialApp(
  // Start the app with the "/" named route. In this case, the app starts
  // on the FirstScreen widget.
  initialRoute: '/',
  routes: {
    // When navigating to the "/" route, build the FirstScreen widget.
    '/': (context) => FirstScreen(),
    // When navigating to the "/second" route, build the SecondScreen widget.
    '/second': (context) => SecondScreen(),
  },
);
Posted by: Guest on August-29-2020
0

navigator push named

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(...);
}
Posted by: Guest on October-08-2021

Code answers related to "navigator push named"

Browse Popular Code Answers by Language