routeTo method
dynamic
routeTo(})
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 https://pub.dev/packages/page_transition to learn more.
Implementation
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);
NyNavigator.instance.router
.navigate(
routeName,
args: nyArgument,
navigationType: navigationType,
result: result,
removeUntilPredicate: removeUntilPredicate,
pageTransitionType: pageTransition,
)
.then((v) => onPop != null ? onPop(v) : (v) {});
}