setFieldValue method

dynamic setFieldValue(
  1. String key,
  2. dynamic value, {
  3. bool refreshState = true,
})

Set the value for a field in the form If the field does not exist, it will throw an exception

Implementation

setFieldValue(String key, dynamic value, {bool refreshState = true}) {
  if (!_data.containsKey(key)) {
    throw Exception("Field $key does not exist in the form");
  }
  _data[key] = value;
  if (!refreshState) return;
  NyForm.stateSetValue(stateName, key, value);
}