convertNullableMIList<T> function

List<T>? convertNullableMIList<T>(
  1. List? data,
  2. T? fromJson(
    1. dynamic
    )
)

for use with MapsIndoors objects

Implementation

List<T>? convertNullableMIList<T>(
    List<dynamic>? data, T? Function(dynamic) fromJson) {
  if (data == null) {
    return null;
  }
  final List<T> list = List.empty(growable: true);
  for (final item in data) {
    final T? convert = fromJson(item);
    if (convert != null) {
      list.add(convert);
    }
  }
  return list;
}