clearMaterialBanners method Null safety

void clearMaterialBanners()

Removes all the MaterialBanners currently in queue by clearing the queue and running normal exit animation on the current MaterialBanner.

Implementation

void clearMaterialBanners() {
  if (_materialBanners.isEmpty || _materialBannerController!.status == AnimationStatus.dismissed) {
    return;
  }
  final ScaffoldFeatureController<MaterialBanner, MaterialBannerClosedReason> currentMaterialBanner = _materialBanners.first;
  _materialBanners.clear();
  _materialBanners.add(currentMaterialBanner);
  hideCurrentMaterialBanner();
}