objFromListOfMap<T> static method
List<T>
objFromListOfMap<
T>( - dynamic data,
- T? forEach(
- dynamic
)
)
Implementation
static List<T> objFromListOfMap<T>(
dynamic data, T? Function(dynamic) forEach) {
final list = <T>[];
if (data is List && data.isNotEmpty) {
data.forEach((e) {
try {
final o = forEach(e);
if (o is T) {
list.add(o);
}
} catch (e, s) {
if (Strapi.i.verbose) {
sPrint("error while parsing strapi object");
sPrint(e);
sPrint(s);
} else {
sPrint(
"ignoring a error while parsing a strapi object, set verbose to true to see the error");
}
}
});
}
return list;
}