deepSearchByValue<E> method
Returns new instance of recursively filtered (by value) Map.
Implementation
Map deepSearchByValue<E>(bool predicate(E value)) =>
LinkedHashMap.fromIterable(keys,
key: (k) => k,
value: (k) {
if (this[k] is Map) {
return (this[k] as Map).deepSearchByValue<E>(predicate);
} else if (this[k] is List) {
return (this[k] as List).deepSearchByValue<E>(predicate);
} else if (this[k] is Set) {
return (this[k] as Set).deepSearchByValue<E>(predicate);
} else if (this[k] is E && predicate(this[k] as E)) {
return this[k];
}
})
..removeWhere(
(key, value) => value == null || (value is Map && value.isEmpty));