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();
}