removeCurrentSnackBar method Null safety

void removeCurrentSnackBar(
  1. {SnackBarClosedReason reason = SnackBarClosedReason.remove}

Removes the current SnackBar (if any) immediately from registered Scaffolds.

The removed snack bar does not run its normal exit animation. If there are any queued snack bars, they begin their entrance animation immediately.


void removeCurrentSnackBar({ SnackBarClosedReason reason = SnackBarClosedReason.remove }) {
  assert(reason != null);
  if (_snackBars.isEmpty) {
  final Completer<SnackBarClosedReason> completer = _snackBars.first._completer;
  if (!completer.isCompleted) {
  _snackBarTimer = null;
  // This will trigger the animation's status callback.
  _snackBarController!.value = 0.0;