clearAll static method

void clearAll()

Clear all overlays efficiently

Implementation

static void clearAll() {
  _controller.update<List<PopOverlayContent>>((state) {
    // Dispose all overlays first
    for (final overlay in state) {
      overlay.dispose();
    }
    // Clear the widget cache
    _PopOverlayWidgetCache.clear();
    // Clear the list
    state.clear();
    return state;
  });

  // Clear the invisible overlays list
  _invisibleController.update<List<String>>((state) {
    state.clear();
    return state;
  });
}