update method

void update(
  1. T? value
)

Implementation

void update(T? value) {
  if (required && value == null) {
    throw ArgumentError.notNull('value');
  }

  // TODO(@melvspace): 10/10/25 should we constrain null values? there are optional/required for that but need to think about it
  if (value != null) {
    if (constraints.any((validate) => !validate(value))) {
      throw ArgumentError.value(
        value,
        'value is not valid because of constraints',
      );
    }
  }

  _value = value;
  notifyListeners();
}