routeIf function
dynamic
routeIf(
- bool condition,
- dynamic routeName, {
- dynamic data,
- Map<
String, dynamic> ? queryParameters, - dynamic result,
- bool removeUntilPredicate(
- Route route
- PageTransitionSettings? pageTransitionSettings,
- PageTransitionType? pageTransition,
- dynamic onPop(
- dynamic value
Navigate to a new route if a condition is met. If the condition is false, the route will not be navigated to.
Implementation
routeIf(bool condition, dynamic routeName,
{dynamic data,
Map<String, dynamic>? queryParameters,
NavigationType navigationType = NavigationType.push,
dynamic result,
bool Function(Route<dynamic> route)? removeUntilPredicate,
PageTransitionSettings? pageTransitionSettings,
PageTransitionType? pageTransition,
Function(dynamic value)? onPop}) async {
if (!condition) return;
await routeTo(routeName,
data: data,
queryParameters: queryParameters,
navigationType: navigationType,
result: result,
removeUntilPredicate: removeUntilPredicate,
pageTransitionSettings: pageTransitionSettings,
pageTransitionType: pageTransition,
onPop: onPop);
}