Answers for "flutter changing screen"

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
2

pass data with screen change flutter

//Screen A
Navigator.pushReplacementNamed(context, "/screenb", arguments: {
      'name': your_data,
    });

//Screen B
Map data = {};
data = ModalRoute.of(context)!.settings.arguments as Map;
Posted by: Guest on September-19-2021

Browse Popular Code Answers by Language