Skip to content

Commit ff2b931

Browse files
authored
Merge pull request #2 from nvshah/fix/1388-initialval_retained-main
fix: respecting initial value from formbuilder map when field misses initial value
2 parents fc48fb9 + 3a2292c commit ff2b931

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/src/form_builder.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,11 @@ class FormBuilderState extends State<FormBuilder> {
213213

214214
_fields[name] = field;
215215
field.registerTransformer(_transformers);
216-
_instantValue[name] = field.initialValue;
216+
217+
field.setValue(
218+
(_instantValue[name] = field.initialValue ?? _instantValue[name]),
219+
populateForm: false,
220+
);
217221
}
218222

219223
void unregisterField(String name, FormBuilderFieldState field) {

0 commit comments

Comments
 (0)