guard method

void guard()

Prevents the beacon from being disposed by its dependants. The beacon will still be disposed if its dependencies are disposed.

final number = Beacon(0)..guard();
final doubled = number.map((value) => value * 2);
doubled.dispose();
number.disposed; // false

Implementation

void guard() {
  _guarded = true;
}