openPage<T> method
Future<T?> ?
openPage<T>(
- BuildContext context,
- String pageName, {
- RoutePushType pushType = RoutePushType.pushNamed,
- Map? arguments,
- RoutePredicate? predicate,
open page
Implementation
Future<T?>? openPage<T>(BuildContext context, String pageName,
{RoutePushType pushType = RoutePushType.pushNamed,
Map<dynamic, dynamic>? arguments,
RoutePredicate? predicate}) {
Map<String, dynamic> args = {'args': arguments};
switch (pushType) {
case RoutePushType.pushNamed:
return Navigator.pushNamed(context, pageName, arguments: args);
case RoutePushType.pushReplacementNamed:
return Navigator.pushReplacementNamed(context, pageName,
arguments: args);
case RoutePushType.popAndPushNamed:
return Navigator.popAndPushNamed(context, pageName, arguments: args);
case RoutePushType.pushAndRemoveUntil:
assert(predicate != null);
return Navigator.pushNamedAndRemoveUntil(
context,
pageName,
predicate!,
arguments: args,
);
}
}