overlayOff method

  1. @override
Future<bool> overlayOff()
override

Always disables any active overlay mode — image, blur, or color — and releases its prevention claim (idempotent — safe to call repeatedly).

The deterministic counterpart to screenshotWithImage, screenshotWithBlur, and screenshotWithColor: unlike the toggle* methods, it does not require knowing the current state.

Prevention set via screenshotOff is never affected: the plugin tracks two separate prevention claims — one owned by screenshotOff/screenshotOn, one owned by the overlay modes — and protection stays engaged while either claim is held. This call releases only the overlay's claim; when no overlay mode is active it is a pure no-op.

Implementation

@override
Future<bool> overlayOff() async {
  // Pure no-op when no overlay mode is active. Clearing the overlay
  // releases only the overlay's claim — an independent claim held via
  // screenshotOff() keeps protection applied.
  if (_isOverlayModeOn) {
    _isOverlayModeOn = false;
    _applyEffective();
  }
  return true;
}