pushOrReplacement<T extends Object?, TO extends Object?> method
Future<T?>
pushOrReplacement<
T extends Object?, TO extends Object?>( - String routeName,
- String replaceRouteName, {
- TO? result,
- Map<String, dynamic> arguments = const {},
- List<String> holdBlocNames = const [],
})
Implementation
Future<T?> pushOrReplacement<T extends Object?, TO extends Object?>(
String routeName,
String replaceRouteName, {
TO? result,
Map<String, dynamic> arguments = const {},
List<String> holdBlocNames = const [],
}) {
if (_isSameTopRoute(routeName, arguments)) {
return Future.value();
}
Map<String, dynamic> newArguments = Map.from(arguments);
newArguments['##holdBlocNames##'] = holdBlocNames;
holdBlocNames.forEach(GlobalStore().pushState);
if (_topRouteName == replaceRouteName) {
newArguments['disableAnimate'] = true;
return state.pushReplacementNamed<T, TO>(
routeName,
result: result,
arguments: newArguments,
);
} else {
return state.pushNamed<T>(
routeName,
arguments: newArguments,
);
}
}