install static method

void install({
  1. List<SocketLane> whitelist = const [],
})

Begin failing every non-whitelisted outbound socket attempt with NetworkIsolationViolation. whitelist lanes (FR-006) are permitted and logged as approved exceptions; the empty whitelist — the default — blocks every socket (safest default, unchanged #832 behavior). Calling install while already active is a no-op, so test setUpAll hooks can call it unconditionally.

Implementation

static void install({List<SocketLane> whitelist = const []}) {
  if (_active) return;
  _lanes = List.of(whitelist);
  _approved.clear();
  _savedIO = IOOverrides.current;
  _savedHttp = HttpOverrides.current;
  IOOverrides.global = _GuardedIOOverrides();
  HttpOverrides.global = _GuardedHttpOverrides();
  _active = true;
}