pushAndClearStack method

void pushAndClearStack(
  1. String route
)

Clears the entire stack and pushes a named route.

Use this for logout or onboarding completion. Example: pushAndClearStack('/login')

Implementation

void pushAndClearStack(String route) {
  if(_ctx.mounted) GoRouter.of(_ctx).go(route);
}