to<T> method
Future<T?>
to<T>(
- Widget page(), {
- bool? opaque,
- Transition? transition,
- Curve? curve,
- Duration? duration,
- String? id,
- String? routeName,
- bool fullscreenDialog = false,
- dynamic arguments,
- List<
BindingsInterface> bindings = const [], - bool preventDuplicates = true,
- bool? popGesture,
- bool showCupertinoParallax = true,
- double gestureWidth(
- BuildContext context
- bool rebuildStack = true,
- PreventDuplicateHandlingMode preventDuplicateHandlingMode = PreventDuplicateHandlingMode.reorderRoutes,
override
Implementation
@override
Future<T?> to<T>(
Widget Function() page, {
bool? opaque,
Transition? transition,
Curve? curve,
Duration? duration,
String? id,
String? routeName,
bool fullscreenDialog = false,
dynamic arguments,
List<BindingsInterface> bindings = const [],
bool preventDuplicates = true,
bool? popGesture,
bool showCupertinoParallax = true,
double Function(BuildContext context)? gestureWidth,
bool rebuildStack = true,
PreventDuplicateHandlingMode preventDuplicateHandlingMode =
PreventDuplicateHandlingMode.reorderRoutes,
}) async {
routeName = _cleanRouteName("/${page.runtimeType}");
// if (preventDuplicateHandlingMode ==
//PreventDuplicateHandlingMode.Recreate) {
// routeName = routeName + page.hashCode.toString();
// }
final getPage = GetPage<T>(
name: routeName,
opaque: opaque ?? true,
page: page,
gestureWidth: gestureWidth,
showCupertinoParallax: showCupertinoParallax,
popGesture: popGesture ?? Get.defaultPopGesture,
transition: transition ?? Get.defaultTransition,
curve: curve ?? Get.defaultTransitionCurve,
fullscreenDialog: fullscreenDialog,
bindings: bindings,
transitionDuration: duration ?? Get.defaultTransitionDuration,
preventDuplicateHandlingMode: preventDuplicateHandlingMode,
);
_routeTree.addRoute(getPage);
final args = _buildPageSettings(routeName, arguments);
final route = _getRouteDecoder<T>(args);
final result = await _push<T>(
route!,
rebuildStack: rebuildStack,
);
_routeTree.removeRoute(getPage);
return result;
}