mapNotNull<T> method
Returns a list containing the results of applying the given transform function to each element
in the original Map.
If the tranform returns null
, it is not included in the output list.
Implementation
List<T> mapNotNull<T>(T Function(String, dynamic) transform) {
List<T> result = [];
if (this != null) {
for (String key in this!.keys) {
T transformedValue = transform(key, this![key]);
if (transformedValue != null) {
result.add(transformedValue);
}
}
}
return result;
}