decodeList<T> static method

List<T> decodeList<T>(
  1. List? value,
  2. T fromJson(
    1. Map
    )
)

Decodes a list from JSON maps or method channel results, returning empty list if null.

Implementation

static List<T> decodeList<T>(List? value, T Function(Map) fromJson) {
  if (value == null) return const [];
  return value.map((e) => fromJson(e as Map)).toList();
}