PlaylistModel.fromJson constructor

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

Implementation

PlaylistModel.fromJson(Map<String, dynamic> json) {
  if (json["id"] is int) id = json["id"];
  if (json["label"] is String) label = json["label"];
  if (json["colorCode"] is String) colorCode = json["colorCode"];
  playlistType = json["playlistType"];
  if (json["repeat"] is int) repeat = json["repeat"];
  if (json["items"] is List) {
    items = json["items"] == null
        ? null
        : (json["items"] as List)
            .map((e) => PlaylistItem2.fromJson(e))
            .toList();
  }
  if (json["schedules"] is List) {
    schedules = json["schedules"] == null
        ? null
        : (json["schedules"] as List)
            .map((e) => PlaylistSchedules.fromJson(e))
            .toList();
  }
  if (json["terminalLinked"] is List) {
    terminalLinked = json["terminalLinked"] == null
        ? null
        : (json["terminalLinked"] as List)
            .map((e) => Terminal.fromJson(e))
            .toList();
  }
}