value property

dynamic value

Getter:

Return the value of the underlying object.

The value used inside the consumer widget will cause the widget to rebuild when updating; or use

watchedVar.consume(() => widget)

to touch() the watched variable itself first and then globalConsume(() => widget).

Implementation

get value {
  // if rx automatic aspect is enabled. (precede over state rx aspect)
  if (stateRxAutoAspectFlag == true) {
    touch(); // Touch to activate rx automatic aspect management.
    //
  } else if (stateWidgetAspectsFlag == true) {
    if (stateWidgetAspects != null) {
      rxAspects.addAll(stateWidgetAspects!);
    } else {
      _isNullBroadcast = true;
    }
  }

  if (_value is! Function) {
    return _value;
  }
  // This is a computed mediator variable.
  final fn = _value as Function;
  final res = fn();
  return res;
}
void value=(dynamic value)

Setter:

Set the value of the underlying object.

Update to the value will notify the host to rebuild; or the underlying object would be a class, then use

watchedVar.ob.updateMethod(...) to notify the host to rebuild.

watchedVar.ob = watchedVar.notify() and then return the underlying object

Implementation

set value(value) {
  if (_value != value) {
    _value = value;
    assert(_pub != null);
    // if (pub != null) {
    publishRxAspects();
    // }
  }
}