popAndPushNamed<T extends Object?, TO extends Object?> method
Future<T?>
popAndPushNamed<T extends Object?, TO extends Object?>(
- String routeName, {
- Object? arguments,
- bool backGestureEnabled = true,
- Transition? transition,
- Duration? transitionDuration,
- TO? result,
Pop the current route off the navigator and push a named route in its place
transitionDuration
is ignored when transition is equals to Transition.material or Transition.cupertino
backGestureEnabled
not works on Android if transition is Transition.material
Implementation
Future<T?> popAndPushNamed<T extends Object?, TO extends Object?>(
String routeName, {
Object? arguments,
bool backGestureEnabled = true,
Transition? transition,
Duration? transitionDuration,
TO? result,
}) {
final route = _buildNamedRoute<T>(
routeName: routeName,
arguments: arguments,
backGestureEnabled: backGestureEnabled,
transition: transition,
transitionDuration: transitionDuration,
);
if (route == null) {
return _state!.popAndPushNamed<T, TO>(
routeName,
arguments: arguments,
result: result,
);
}
_state!.pop<TO>(result);
return _state!.push<T>(route);
}