set method
dynamic
set(
- dynamic value, {
- bool notify = true,
})
override
Implementation
@override
set(dynamic value, {bool notify = true})
{
if (setter != null)
{
value = setter!(value);
}
// null value
if (value == null)
{
_value.clear();
if (notify != false) notifyListeners();
return;
}
// map
if (value is Map)
{
_value = [];
_value.add(value);
if (notify != false) notifyListeners();
return;
}
// list of values
if (value is List)
{
_value = value;
if (notify != false) notifyListeners();
return;
}
// list of values
if (_value is List<Map>)
{
Binding? binding = Binding.fromString(key);
for (var map in _value) {
map[binding?.property] = value.toString();
}
if (notify != false) notifyListeners();
return;
}
// single value
if (value is String)
{
_value.clear();
var options = value.split(",");
for (String v in options) {
if (v.trim() != '') _value.add(v.trim());
}
if (notify != false) notifyListeners();
}
}