3

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..

Sana Afreen
  • 127
  • 1
  • 2
  • 9
  • this may help you : https://stackoverflow.com/questions/46483949/how-to-get-current-route-path-in-flutter – haresh Dec 31 '19 at 10:14

1 Answers1

9

try this:

var route = ModalRoute.of(context);

if(route!=null){
  print(route.settings.name);
}
Mehrdad
  • 1,170
  • 9
  • 14