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 String coverArtId, required this.playCount, required this.artistName, required this.artistId, required this.year, required this.songCount, required this.genres, required this.duration, }) : _coverArtId = coverArtId; final String id; final String name; @JsonKey(name: "coverArt") final String _coverArtId; 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); }