updateValue method

  1. @override
void updateValue(
  1. Map<String?, dynamic>? value, {
  2. bool? onlySelf,
  3. bool? emitEvent,
  4. bool? emitModelToViewChange,
  5. String? rawValue,
})
override

Set the value of the AbstractControl to value.

If onlySelf is true, this change will only affect the validation of this Control and not its parent component. This defaults to false.

If emitEvent is true, this change will cause a valueChanges event on the Control to be emitted. This is the default behavior.

If emitModelToViewChange is true, the view will be notified about the new value via an onChange event. This is the default behavior if emitModelToViewChange is not specified.

Implementation

@override
void updateValue(Map<String?, dynamic>? value,
    {bool? onlySelf,
    bool? emitEvent,
    bool? emitModelToViewChange,
    String? rawValue}) {
  // Treat null and empty as the same thing.
  if (value != null && value.isEmpty) value = null;
  _checkAllValuesPresent(value);
  for (var name in controls.keys) {
    controls[name]!.updateValue(value == null ? null : value[name],
        onlySelf: true,
        emitEvent: emitEvent,
        emitModelToViewChange: emitModelToViewChange);
  }
  updateValueAndValidity(onlySelf: onlySelf, emitEvent: emitEvent);
}