removeCurrentMaterialBanner method

void removeCurrentMaterialBanner({
  1. MaterialBannerClosedReason reason = MaterialBannerClosedReason.remove,
})

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

The removed material banner does not run its normal exit animation. If there are any queued material banners, they begin their entrance animation immediately.

Implementation

void removeCurrentMaterialBanner({ MaterialBannerClosedReason reason = MaterialBannerClosedReason.remove }) {
  if (_materialBanners.isEmpty) {
    return;
  }
  final Completer<MaterialBannerClosedReason> completer = _materialBanners.first._completer;
  if (!completer.isCompleted) {
    completer.complete(reason);
  }

  // This will trigger the animation's status callback.
  _materialBannerController!.value = 0.0;
}