subscribe<V> method

void subscribe<V>(
  1. TFieldProp<V> source,
  2. T formatter(
    1. V val
    ), {
  3. bool cancelOnUserEdit = false,
})

Implementation

void subscribe<V>(TFieldProp<V> source, T Function(V val) formatter, {bool cancelOnUserEdit = false}) {
  _valueNotifier ??= ValueNotifier<T>(value);

  final subscriber = _TPropSubscriber(
    cancelOnUserEdit: cancelOnUserEdit,
    onValueChanged: (value) => _setValue(formatter(value)),
  );

  source._subscribers[this] = subscriber;
}