clearSnackBars method Null safety
Removes all the snackBars currently in queue by clearing the queue and running normal exit animation on the current snackBar.
Implementation
void clearSnackBars() {
if (_snackBars.isEmpty || _snackBarController!.status == AnimationStatus.dismissed) {
return;
}
final ScaffoldFeatureController<SnackBar, SnackBarClosedReason> currentSnackbar = _snackBars.first;
_snackBars.clear();
_snackBars.add(currentSnackbar);
hideCurrentSnackBar();
}