toClearAndPushNamed function
Clear all existing routes and push a named route onto the navigation stack.
Example:
toClearAndPushNamed('/dashboard');
Implementation
void toClearAndPushNamed(String routeName, {Map<String, dynamic>? arguments}) {
Navigator.of(Utils.navigatorKey.currentContext!).pushNamedAndRemoveUntil(
routeName,
(route) => false,
arguments: arguments,
);
}