value property
The current state of the reactive object.
Reading this property automatically registers the object as a dependency of the currently active observer (e.g., inside an LxComputed builder).
Implementation
@override
T get value {
if (_LevitReactiveCore._fastPath) return _value;
final proxy = _LevitReactiveCore.proxy;
if (proxy != null) {
LxReactive resolved = this;
if (proxy is LevitReactiveReadResolver) {
resolved =
(proxy as LevitReactiveReadResolver).resolveReactiveRead(this);
}
if (!identical(resolved, this) && resolved is LxReactive<T>) {
return resolved.value;
}
_reportRead(proxy, resolvedReactive: resolved);
} else if (_LevitReactiveCore._asyncZoneDepth > 0) {
final zoneTracker =
Zone.current[_LevitReactiveCore.asyncComputedTrackerZoneKey];
if (zoneTracker is LevitReactiveObserver) {
LxReactive resolved = this;
if (zoneTracker is LevitReactiveReadResolver) {
resolved = (zoneTracker as LevitReactiveReadResolver)
.resolveReactiveRead(this);
}
if (!identical(resolved, this) && resolved is LxReactive<T>) {
return resolved.value;
}
_reportRead(zoneTracker, resolvedReactive: resolved);
}
}
return _value;
}