I have a StatefulWidget widget with a LinkedHashMap member done like this:
LinkedHashMap _items = new LinkedHashMap<String, List<dynamic>>();
Now I need to filter the items inside the List<dynamic>
items of the Map.
I use this code to filter:
function filter(_items) {
return _items.map((day, items) {
return new MapEntry(day, items.where((i) {
return i.stringProperty.contains(widget.filter);
}).toList());
});
}
But I get the error in the subject
type '(dynamic) => dynamic' is not a subtype of type '(dynamic) => bool' of 'test'
I solved with this code:
function filter(_items) {
return _items.map((day, items) {
return new MapEntry(day, items.where((i) {
return i.stringProperty.contains(widget.filter) ? true : false;
}).toList());
});
}
It seems the contains
function does not return a bool value.