I had the exact same error, multiple Dropdowns all feeding from the same static list, the only difference is that in my case, it was a list of Objects, not Strings.
So, if it’s a static list, there’s no way it’s empty, no duplicate values in the list, AND you already make sure value
is not empty? Then the only option remaining is that item.value
is different than value
In my case, as it was an Object list, I had to overwrite operator ==
and hashcode
methods in my Object class.
bool operator ==(dynamic other) =>
other != null && other is TimeSelection && this.hour == other.hour;
@override
int get hashCode => super.hashCode;
And that was it. I didn’t had to initialize _value1
or _value2