push static method
void
push(
- BuildContext context, {
- required String routeName,
- Object? arguments,
- bool clearStack = false,
push Push a route to the navigator
- Param
context
The context to push the route to - Param
routeName
The routeName to push - Param
clearStack
Clear the stack before pushing the - Example:
BaseNavigation.push(context, routeName: '/', clearStack: true);
Implementation
static void push(BuildContext context,
{required String routeName, Object? arguments, bool clearStack = false}) {
if (clearStack)
Navigator.pushNamedAndRemoveUntil(context, '$routeName', (r) => false,
arguments: arguments);
else
Navigator.pushNamed(context, '$routeName', arguments: arguments);
}