to method
Navigates to the specified route.
routeName
is the name of the route to navigate to.
args
are the optional arguments to pass to the route.
Implementation
void to(String routeName, {Map<String, dynamic>? args}) {
try {
if (context != null) {
Navigator.pushNamed(context!, routeName, arguments: args);
} else if (navigatorKey != null) {
navigatorKey!.currentState!.pushNamed(routeName, arguments: args);
}
} catch (e) {
print('Error in to: $e');
}
}