$list<T> static method

List<T>? $list<T>(
  1. dynamic json,
  2. String key
)

Implementation

static List<T>? $list<T>(dynamic json, String key) {
  final value = _getJsonValue(json, key);
  if (value is List) {
    try {
      return List<T>.from(value);
    } catch (e) {
      if (!isRelease) {
        throw '$_formJsonErrorStart: $key -> List<${T.toString()}> 类型转换失败, '
            'json data: \n'
            '================================================================\n'
            '$value\n'
            '================================================================\n'
            '$_formJsonErrorEnd';
      }
    }
  }
  return null;
}