value property

T get value

Returns the current value and subscribes to changes in the beacon when used within a Beacon.effect or Beacon.derived.

Implementation

T get value {
  if (_isEmpty) throw UninitializeLazyReadException(name);
  assert(() {
    if (isDisposed) {
      // coverage:ignore-start
      // ignore: avoid_print
      print(
        '[WARNING]: You read the value of a disposed beacon($name). '
        'This is not recommended and is probably a bug in your code. '
        'If you intend to reuse a beacon, try resetting instead of disposing it.',
      );
      // coverage:ignore-end
    }
    return true;
  }());
  currentConsumer?.startWatching(this);
  return _value;
}