convertListNS<T, S> function

List<T> convertListNS<T, S>(
  1. Iterable? json,
  2. T parse(
    1. S element
    )
)

Parses the given list into a list of PODOs. Unlike convertList, it returns an empty list if json is null

Implementation

List<T> convertListNS<T, S>(Iterable? json, T parse(S element)) {
  final result = <T>[];
  if (json != null)
    for (final each in json)
      result.add(parse(each as S));
  return result;
}