dropdown_button2 icon indicating copy to clipboard operation
dropdown_button2 copied to clipboard

If items in the list is changed then it throw error

Open kailash-elivaas opened this issue 1 year ago • 3 comments

There should be exactly one item with [DropdownButtonFormField]'s value: ... Either zero or 2 or more [DropdownMenuItem]s were detected with the same value 'package:dropdown_button2/src/dropdown_button2.dart': Failed assertion: line 1045 pos 11: 'items == null ||

the items list has unique value but the items list change and want to reset the value to empty values

kailash-elivaas avatar Apr 11 '25 11:04 kailash-elivaas

Can you provide a minimal reproducible sample?

AhmedLSayed9 avatar Apr 11 '25 17:04 AhmedLSayed9

Added code in blow git directory

https://github.com/kkhura/drop_down/tree/main

I need to clear previous value to blank or null not work because of below code

items == null || items.isEmpty || value == null || items.where((DropdownMenuItem<T> item) { return item.value == value; }).length == 1, "There should be exactly one item with [DropdownButtonFormField]'s value: " '$value. \n' 'Either zero or 2 or more [DropdownMenuItem]s were detected ' 'with the same value', ),

kailash-elivaas avatar Apr 14 '25 03:04 kailash-elivaas

Can you make a minimal sample, please? You can start with Simple DropdownButton2 with no styling sample at ReadMe and update it to reproduce the issue.

Also, which version of the package you're using?

AhmedLSayed9 avatar Apr 14 '25 18:04 AhmedLSayed9