Closed zangen closed 4 years ago
@ zangen , I Got same issue. did you able to solve the problem ?
I have the same problem Found out that the source code here somehow is not true
assert(widget.value == null ||
widget.items.where((DropdownMenuItem<T> item) => item.value == widget.value).length == 1);
_selectedIndex = null;
for (int itemIndex = 0; itemIndex < widget.items.length; itemIndex++) {
if (widget.items[itemIndex].value == widget.value) {
_selectedIndex = itemIndex;
return;
}
}
replace this line
assert(widget.value == null || widget.items.where((DropdownMenuItem<T> item) => item.value == widget.value).length == 1);
for this
assert(widget.value == null || widget.items.where((DropdownMenuItem<T> item) => item.value == widget.value).length <= 1);
Hello @zangen @FarhanSaikh @tonytang0114 @lwcinfo ,
Thanks for reporting this issue, finding the root cause and finding a fix.
PR #10 has just been merged. A new parameter has been added defaulted to true to allow the avoidance of the items check part of this assert.
assertUniqueValue: false,
Can you please let us know whether adding the above line to your call solves your issue with the latest version of the plugin?
Hello @zangen @FarhanSaikh @tonytang0114 @lwcinfo ,
I recently realized that the latest version of the plugin is not available on pub.dev and that if you want to try it, you would have to either wait for the publication or temporarily use the following in your pubspec.yaml
file:
searchable_dropdown:
git:
url: https://github.com/icemanbsi/searchable_dropdown.git
Sorry for the inconvenience.
Hi @zangen @FarhanSaikh @tonytang0114 @lwcinfo I've published the update (thanks @lcuis ) on pub.dev. I'll close this issue and feel free to reopen if you think this issue is not solved yet. Thanks
I use your demo,i had this problen, family: Roboto, size: 15.0, weight: 400, baseline: ideographic, decoration: TextDecoration.none, softWrap: wrapping at box width, overflow: clip): 'package:searchable_dropdown/searchable_dropdown.dart': Failed assertion: line 90 pos 12: 'widget.value == null || widget.items.where((DropdownMenuItem item) => item.value == widget.value).length == 1': is not true.