ComputedSignal<T, V> constructor

ComputedSignal<T, V>(
  1. BaseSignal<T> _source,
  2. V _transform(
    1. T
    )
)

Implementation

ComputedSignal(this._source, this._transform)
  : super(_transform(_source.value)) {
  _subscription = _source.stream.listen((data) {
    final newValue = _transform(data);
    if (unsafeValue != newValue) {
      unsafeValue = newValue;
      controller.add(newValue);
    }
  });
}