routeTo method Null safety

dynamic routeTo(
  1. String routeName,
  2. {dynamic data,
  3. NavigationType navigationType = NavigationType.push,
  4. dynamic result,
  5. bool removeUntilPredicate(
    1. Route route
  6. Duration? transitionDuration,
  7. PageTransitionType? pageTransition,
  8. dynamic onPop(
    1. dynamic value

Navigate to a new route in your /routes/router.dart.

It requires a String routeName e.g. "/my-route"

Optional variables in data that you can pass in dynamic objects to the next widget you navigate to.

navigationType can be assigned with the following: NavigationType.push, NavigationType.pushReplace, NavigationType.pushAndRemoveUntil or NavigationType.popAndPushNamed

pageTransitionType allows you to assign a transition type for when navigating to the new route. E.g. PageTransitionType.fade or PageTransitionType.bottomToTop. See to learn more.


routeTo(String routeName,
    {dynamic data,
    NavigationType navigationType = NavigationType.push,
    dynamic result,
    bool Function(Route<dynamic> route)? removeUntilPredicate,
    Duration? transitionDuration,
    PageTransitionType? pageTransition,
    Function(dynamic value)? onPop}) {
  NyArgument nyArgument = NyArgument(data);
        args: nyArgument,
        navigationType: navigationType,
        result: result,
        removeUntilPredicate: removeUntilPredicate,
        pageTransitionType: pageTransition,
      .then((v) => onPop != null ? onPop(v) : (v) {});