to<T extends Object?> method

Future<T?>? to<T extends Object?>(
  1. Widget page(), {
  2. bool? opaque,
  3. Transition? transition,
  4. Curve? curve,
  5. Duration? duration,
  6. String? id,
  7. String? routeName,
  8. bool fullscreenDialog = false,
  9. dynamic arguments,
  10. List<BindingsInterface> bindings = const [],
  11. bool preventDuplicates = true,
  12. bool? popGesture,
  13. bool showCupertinoParallax = true,
  14. double gestureWidth(
    1. BuildContext context
    )?,
  15. bool rebuildStack = true,
  16. PreventDuplicateHandlingMode preventDuplicateHandlingMode = PreventDuplicateHandlingMode.reorderRoutes,
})

Navigation.push() shortcut.

Pushes a new page to the stack

It has the advantage of not needing context, so you can call from your business logic

You can set a custom transition, and a transition duration.

You can send any type of value to the other route in the arguments.

Just like native routing in Flutter, you can push a route as a fullscreenDialog,

id is for when you are using nested navigation, as explained in documentation

If you want the same behavior of ios that pops a route when the user drag, you can set popGesture to true

If you're using the BindingsInterface api, you must define it here

By default, SINT will prevent you from push a route that you already in, if you want to push anyway, set preventDuplicates to false

Implementation

Future<T?>? to<T extends Object?>(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}) {
  return searchDelegate(id).to(
    page,
    opaque: opaque,
    transition: transition,
    curve: curve,
    duration: duration,
    id: id,
    routeName: routeName,
    fullscreenDialog: fullscreenDialog,
    arguments: arguments,
    bindings: bindings,
    preventDuplicates: preventDuplicates,
    popGesture: popGesture,
    showCupertinoParallax: showCupertinoParallax,
    gestureWidth: gestureWidth,
    rebuildStack: rebuildStack,
    preventDuplicateHandlingMode: preventDuplicateHandlingMode,
  );
}