Playlist.fromJson constructor
Playlist.fromJson(
- Map<String, dynamic> json
)
Implementation
factory Playlist.fromJson(Map<String, dynamic> json) {
return Playlist(
id: json['id'],
name: json['name'],
description: json['description'] ?? '',
isPublic: json['public'] ?? false,
isCollaborative: json['collaborative'] ?? false,
href: json['href'],
uri: json['uri'],
spotifyUrl: json['external_urls']['spotify'],
trackCount: json['tracks']['total'],
owner: User.fromJson(json['owner']),
images: List<String>.from(
(json['images'] ?? []).map((img) => img['url']),
),
);
}