Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get current route name in flutter?

I am a recent flutter developer. How can i get current route name?I am having a common list view in two different routes. I want to hide certain properties in list based on routes.

Please help me..

like image 701
Sana Afreen Avatar asked Oct 27 '25 05:10

Sana Afreen


1 Answers

try this:

var route = ModalRoute.of(context);

if(route!=null){
  print(route.settings.name);
}
like image 90
Mehrdad Avatar answered Oct 29 '25 20:10

Mehrdad