getObjList<T> static method

List<T>? getObjList<T>(
  1. String source
)

Converts JSON string list source to object list.

Implementation

static List<T>? getObjList<T>(String source) {
  if (source.isEmpty) return null;
  try {
    List? list = json.decode(source);

    return list?.map((value) {
      return value;
    }).toList() as List<T>?;
  } catch (e) {
    print('JsonUtil convert error, Exception:${e.toString()}');
  }

  return null;
}