clearSnackBars method

void clearSnackBars()

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!.isDismissed) {
    return;
  }
  final ScaffoldFeatureController<SnackBar, SnackBarClosedReason> currentSnackbar = _snackBars.first;
  _snackBars.clear();
  _snackBars.add(currentSnackbar);
  hideCurrentSnackBar();
}