blockAppOpen method

void blockAppOpen(
  1. String reason, {
  2. Duration timeout = _defaultBlockerTimeout,
})

Block app-open ads until unblockAppOpen is called with the same reason. timeout is a safety net — the blocker auto-clears after it elapses, so a missed unblock can't permanently disable app-open ads.

Implementation

void blockAppOpen(
  String reason, {
  Duration timeout = _defaultBlockerTimeout,
}) {
  _appOpenBlockers.add(reason);
  _blockerTimeouts[reason]?.cancel();
  _blockerTimeouts[reason] = Timer(timeout, () {
    if (_appOpenBlockers.remove(reason)) {
      dPrint('⏰ AppOpen blocker "$reason" auto-expired');
    }
    _blockerTimeouts.remove(reason);
  });
  dPrint('🛡️ AppOpen blocked: $reason (active: $_appOpenBlockers)');
}