This looks possible duplicate of
Flutter Navigator.popUntil() with ModalRoute.withName() not working in profile and release mode
But it's not.
The above question resolves the issue of mismatched route names, But in my case, RouteSettings is always null.
Issue only for Android and only for Release/Profile builds
// Pushing the route
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) {
return ScreenA();
},
settings: RouteSettings(name: "screenA"),
),
);
// Popping until pushed route
Navigator.of(context).popUntil((route) {
print(route.settings.name);
// Here name and arguments are always null
return route.settings.name == 'screenA';
});
UPDATE
Also tried with pushNamed
with specified routes, and onGenerateRoute
method. RouteSettings.name
and RouteSettings.arguments
is always null.
Flutter 1.22.5