Answers for "flutter navigation example"

16

flutter navigate to new screen

// Within the `FirstRoute` widget
onPressed: () {
  Navigator.push(
    context,
    MaterialPageRoute(builder: (context) => SecondRoute()),
  );
}
Posted by: Guest on March-25-2020
1

flutter named navigation

Navigator.pushNamed(context, '/second');
Posted by: Guest on March-04-2021
3

flutter navigation

// inside MaterialApp in main.dart
routes: {
        '<route_name>': (context) => MySecondscreen(),
      },
      
// where you want to execute the code
Navigator.pushNamed(context, '<route_name>');
Posted by: Guest on June-02-2021
0

flutter unload screen from stack

Navigator.pushAndRemoveUntil(
  context,
  MaterialPageRoute(builder: (context) => MainPage()),
  (Route<dynamic> route) => false,
);
Posted by: Guest on July-10-2020

Browse Popular Code Answers by Language