watchOnly<R> method
Watch this Observable
for changes.
Whenever this Observable
emits new value, if selector
returns a different value, the context
will be rebuilt.
Returns the selected value.
It is safe to call this method multiple times within the same build method.
Implementation
R watchOnly<R>(BuildContext context, R Function(T value) selector) {
final observable = InheritedContextWatch.of(context)
.getOrCreateObservable<T>(context, this);
if (observable == null) return selector(value);
final selectedValue = selector(value);
observable.watchOnly(selector, selectedValue);
return selectedValue;
}