Question

Flutter Navigator.replace() example

I need to replace my current screen and found replace method in Navigator's API. But I didn't find any example for it. Maybe somebody knows how to use it.

Thanks.

 46  50089  46
1 Jan 1970

Solution

 66

I usually use

Route route = MaterialPageRoute(builder: (context) => NextPage());
Navigator.pushReplacement(context, route);

Hope it helps

2018-10-29

Solution

 23

I have never used Navigator.replace() but this Navigator.pushReplacementNamed might help you.

Navigator.pushReplacementNamed(context, '/thread_list');
2018-06-29