File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -308,6 +308,17 @@ class _FormBuilderDropdownState<T>
308308 final currentlyChilds =
309309 widget.items.map ((e) => e.child.toString ()).toList ();
310310
311+ if (! currentlyValues.contains (initialValue) &&
312+ ! initialValue.emptyValidator ()) {
313+ assert (
314+ currentlyValues.contains (initialValue) && initialValue.emptyValidator (),
315+ 'The initialValue [$initialValue ] is not in the list of items or is not null or empty. '
316+ 'Please provide one of the items as the initialValue or update your initial value. '
317+ 'By default, will apply [null] to field value' ,
318+ );
319+ setValue (null );
320+ }
321+
311322 if ((! listEquals (oldChilds, currentlyChilds) ||
312323 ! listEquals (oldValues, currentlyValues)) &&
313324 (currentlyValues.contains (initialValue) ||
You can’t perform that action at this time.
0 commit comments