push static method

void push(
  1. BuildContext context, {
  2. required String routeName,
  3. Object? arguments,
  4. 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);
}