Summary:
So if you use your example code. Then set a default value of the drop down. If you press save the form validation returns null thus failing validation.
Steps to reproduce
So in your example if you change the empty array here
Your example on the main page is wrong, I think it's from an old build. You use hintText in it while in the short example you use hintWidget, you should fix that.
I got lost trying to figure out what I was doing wrong.
Hi folks,
Please update this package. I am using 0.16 (latest). It was running fine with flutter 2.5.3, now I have upgraded to 2.8.0 and this package is not working with android/ios, It says "Error: No named parameter with the name 'autovalidate'.". Please see the attached screenshot and solve it soon. Thanks.
Returning null around here var existingItem = dataSource!.singleWhere(((itm) => itm[valueField] == item), orElse: () => null); at line 72 is causing this. I think should replace null by [] but I did not test it.
E/flutter (13216): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: setState() called after dispose(): FormFieldState<dynamic>#03479(lifecycle state: defunct, not mounted)
E/flutter (13216): This error happens if you call setState() on a State object for a widget that no longer appears in the widget tree (e.g., whose parent widget no longer includes the widget in its build). This error can occur when code calls setState() from a timer or an animation callback.
E/flutter (13216): The preferred solution is to cancel the timer or stop listening to the animation in the dispose() callback. Another solution is to check the "mounted" property of this object before calling setState() to ensure the object is still in the tree.
E/flutter (13216): This error might indicate a memory leak if setState() is being called because another object is retaining a reference to this State object after it has been removed from the tree. To avoid memory leaks, consider breaking the reference to this object during dispose().
E/flutter (13216): #0 State.setState.<anonymous closure> (package:flutter/src/widgets/framework.dart:1073:9)
E/flutter (13216): #1 State.setState (package:flutter/src/widgets/framework.dart:1108:6)
E/flutter (13216): #2 FormFieldState.didChange (package:flutter/src/widgets/form.dart:409:5)
E/flutter (13216): #3 new MultiSelectFormField.<anonymous closure>.<anonymous closure> (package:multiselect_formfield/multiselect_formfield.dart:120:25)
E/flutter (13216): <asynchronous suspension>
E/flutter (13216):
Have anyone the same problem or can help me please?
════════ Exception caught by widgets library ═══════════════════════════════════
The following _TypeError was thrown building MultiSelectFormField(dirty, dependencies: [_InheritedTheme, _LocalizationsScope-[GlobalKey#9fe74]], state: FormFieldState<dynamic>#113e5):
type '() => Null' is not a subtype of type '(() => Map<String, dynamic>)?' of 'orElse'
The relevant error-causing widget was
MultiSelectFormField
lib/…/select/multiselect.dart:41
When the exception was thrown, this was the stack
#0 ListMixin.singleWhere (dart:collection/list.dart)
#1 new MultiSelectFormField.<anonymous closure>._buildSelectedOptions.<anonymous closure>
package:multiselect_formfield/multiselect_formfield.dart:72
#2 List.forEach (dart:core-patch/growable_array.dart:403:8)
#3 new MultiSelectFormField.<anonymous closure>._buildSelectedOptions
package:multiselect_formfield/multiselect_formfield.dart:71
#4 new MultiSelectFormField.<anonymous closure>
package:multiselect_formfield/multiselect_formfield.dart:168
...
════════════════════════════════════════════════════════════════════════════════
If not stated otherwise there will be a UnderLineInputBoarder. Could this be made a voluentary addition? Instead of having code in the plugin to create it if not stated to make none.
Hi, I want to thank you about your widget, it's very helpful. I am looking for a option that can let me enable or disable the multiselect. Can you help me? Thanks