setData method
void
setData()
Implementation
void setData()
{
// value is not in data?
if (!_containsOption())
{
var value = options.isNotEmpty ? options[0].value : null;
// set to first entry if no datasource
if (datasource == null)
{
// if we set value to itself it will cause an infinite loop
if (this.value != value) this.value = value;
}
// set to first entry after data has been returned
else if (options.isNotEmpty)
{
// if we set value to itself it will cause an infinite loop
if (this.value != value) this.value = value;
}
}
dynamic data;
options.forEach((option)
{
if (option.value == value)
{
data = option.data;
this.label = option.labelValue;
}
});
this.data = data;
}