updateField method Null safety
- FormField field
Implementation
FormData updateField(FormField field) {
final fields = List<FormField>.from(this.fields);
final index = fields.toList().indexWhere((f) => field.isSameKey(f));
if (index == -1) {
fields.add(field);
} else {
fields[index] = field;
}
return FormData(fields: fields);
}