I want to navigate to different Routes using a Drawer, though I do not want to open a new instance of a Route each time I tap on it if I am already on that Route, rather I would prefer that in this case a new Route is not opened. This is my code so far:
Widget build(BuildContext context){
return new Drawer(
child:
new ListView(
children: <Widget>[
new ListTile(
title: new Text("NewRoute"),
onTap: () {
Navigator.of(context).pop;
Navigator.of(context).pushNamed('/NewRoute');
}
)
)
)
}
I want to use a conditional statement to check whether we are on a certain route. I know there is a way to check which Route we are on currently with the isCurrent of the Route class
https://docs.flutter.io/flutter/widgets/Route/isCurrent.html
though I am not sure how to implement it.
Thank you in advance!