setInitialValue method
Set the initial value for a form attribute.
The setInitialValue function is used to set the initial value for a specific
form attribute. It checks if the attribute exists in the _attributes map, and
if so, it sets the initial value in the _values map, updates the corresponding
ValueNotifier, and sets the value in the attribute's controller. If the attribute
does not exist, the function does nothing.
Parameters:
attribute: The identifier of the form attribute for which you want to set the initial value.value: The initial value to be set for the specified form attribute.
Implementation
setInitialValue(String attribute, dynamic value) {
if (!_attributes.containsKey(attribute)) {
return;
}
_values[attribute] = value;
_getValueNotifier(attribute).value = value;
final modValue = _onAfterSetInitialValue(attribute, value);
getController(attribute).text = modValue?.toString() ?? '';
}