deepReplaceValues<T> function
Replaces values applying replacer
to values that matches filter
.
Implementation
Object? deepReplaceValues<T>(
Object? o, ValueFilter filter, ValueReplacer replacer) {
if (o == null) return null;
if (filter(null, null, o)) {
return replacer(null, null, o);
} else if (o is List) {
deepReplaceListValues(o, filter, replacer);
return o;
} else if (o is Map) {
deepReplaceMapValues(o, filter, replacer);
return o;
} else if (o is Set) {
deepReplaceSetValues(o, filter, replacer);
return o;
} else {
return o;
}
}