getCurrentNavigatorRouteName static method
Trick explained here: https://github.com/flutter/flutter/issues/20451 Note 'ModalRoute.of(context).settings.name' doesn't always work.
Implementation
static String? getCurrentNavigatorRouteName(BuildContext context) {
late Route currentRoute;
Navigator.popUntil(context, (route) {
currentRoute = route;
return true;
});
return currentRoute.settings.name;
}