icemanbsi / searchable_dropdown

MIT License
107 stars 162 forks source link

RangeError (index): Invalid value #78

Open rodrigolangowski opened 4 years ago

rodrigolangowski commented 4 years ago

In my app, I made a series of dropdown in cascade. When I select an item, the next dropdown is automatically filled. For example, there are 10 items in the first dropdown, so I select the item 8. If I change the selection of the first dropdown, and so the second changes its values, now going to one that has 5 elements, we have the error RangeError (index): Invalid value: Not in range 0..4, including 7. Because the second list has still its index of the first selection. How do I reset the index of a SearchDropdown?

kay14 commented 4 years ago

Have you tried added adding keys to your parent stateful widget which holds the SeachableDropdown? Try it, that would do the trick for you. Good luck!

omartinma commented 4 years ago

I dont know if what @kay14 meant it was to add a UniqueKey() for every place you use the SeachableDropdown but it makes the trick for me but still dont understand why. Any reason?

blbhargav commented 3 years ago

Any updates on this ?

sarathkumarps commented 3 years ago

Any solutions :(

blbhargav commented 3 years ago

I ended up writing my own dropdown search (Necessity is mother of inventions)