visitAll<T> function
Visits all of the DartObject
s, accumulating the results of recuseFn
.
If the DartObject is a list, then it will recursively visitAll
on that list. Otherwise, then it will call recuseFn
on the object.
Implementation
List<T> visitAll<T>(
Iterable<DartObject> objs, T? Function(DartObject) recurseFn) {
var metadata = <T>[];
for (var obj in objs) {
var maybeList = obj.toListValue();
if (maybeList != null) {
metadata.addAll(visitAll<T>(maybeList, recurseFn));
} else {
var value = recurseFn(obj);
if (value != null) {
metadata.add(value);
}
}
}
return metadata;
}