import 'package:json_annotation/json_annotation.dart'; import 'package:ocarina/api/subsonic/subsonic.dart'; part 'album.g.dart'; @JsonSerializable() class Album { Album({ required this.id, required this.name, required this.coverArtId, required this.playCount, required this.artistName, required this.artistId, required this.year, required this.songCount, required this.genres, required this.duration, }); final String id; final String name; @JsonKey(name: "coverArt") final String coverArtId; @JsonKey(defaultValue: 0) final int playCount; @JsonKey(name: "artist") final String artistName; final String artistId; final int? year; final int songCount; final List genres; final int duration; String get coverArtUrl => SubsonicApiService().getCoverArtUrl(coverArtId); factory Album.fromJson(Map json) => _$AlbumFromJson(json); Map toJson() => _$AlbumToJson(this); }