markAnyModalActive static method

void markAnyModalActive()

Manually bump anyModalDepth up by one. Pair with markAnyModalInactive once the modal is dismissed. Useful for non-route-based overlays that NavigatorObserver cannot see — notably Scaffold.showBottomSheet (persistent bottom sheets), which are anchored to Scaffold state instead of the Navigator.

Example:

final controller = Scaffold.of(context).showBottomSheet(...);
CNTabBarRouteObserver.markAnyModalActive();
controller.closed.whenComplete(CNTabBarRouteObserver.markAnyModalInactive);

Implementation

static void markAnyModalActive() {
  _anyModalDepth.value = _anyModalDepth.value + 1;
}