toList static method

List<ChannelData> toList(
  1. String? res
)

Implementation

static List<ChannelData> toList(String? res) {
  List<dynamic> decodedList = json.decode(res ?? '[]');
  List<ChannelData> channelDataList = decodedList.map((item) {
    return ChannelData(
      id: item['id'],
      name: item['name'],
      desc: item['desc'],
      imp: item['imp'],
    );
  }).toList();
  return channelDataList;
}