launchNewScreenWithNewTask<T> function
Removes all previous screens from the back stack and redirect to new screen with provided screen tag
launchNewScreenWithNewTask(context, '/HomePage');
this is sample code
Implementation
Future<T?> launchNewScreenWithNewTask<T>(
BuildContext context, String tag) async =>
Navigator.of(context).pushNamedAndRemoveUntil(tag, (r) => false);