LyricSrcEntity_c.fromJson constructor

LyricSrcEntity_c.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory LyricSrcEntity_c.fromJson(Map<String, dynamic> json) {
  if (json.isEmpty) {
    return LyricSrcEntity_c();
  }
  final resrc = LyricSrcEntity_c();
  // lrc
  final lrc = json["lrc"];
  List? list;
  if (lrc is List) {
    list = lrc;
  } else if (lrc is String) {
    if (lrc.isNotEmpty) {
      list = convert.jsonDecode(lrc);
    } else {
      list = [];
    }
  }
  if (null != list) {
    for (int i = 0; i < list.length; ++i) {
      resrc.lrc.add(LyricSrcItemEntity_c.fromJson(list[i]));
    }
  }
  // info
  json.forEach((key, value) {
    if (key != "lrc") {
      resrc.info[key] = value;
    }
  });
  return resrc;
}