fix: year can be null
This commit is contained in:
parent
4bc2ad1285
commit
017c52f96d
2 changed files with 2 additions and 2 deletions
|
@ -26,7 +26,7 @@ class Album {
|
||||||
@JsonKey(name: "artist")
|
@JsonKey(name: "artist")
|
||||||
final String artistName;
|
final String artistName;
|
||||||
final String artistId;
|
final String artistId;
|
||||||
final int year;
|
final int? year;
|
||||||
final int songCount;
|
final int songCount;
|
||||||
final List<String> genres;
|
final List<String> genres;
|
||||||
final int duration;
|
final int duration;
|
||||||
|
|
|
@ -13,7 +13,7 @@ Album _$AlbumFromJson(Map<String, dynamic> json) => Album(
|
||||||
playCount: (json['playCount'] as num?)?.toInt() ?? 0,
|
playCount: (json['playCount'] as num?)?.toInt() ?? 0,
|
||||||
artistName: json['artist'] as String,
|
artistName: json['artist'] as String,
|
||||||
artistId: json['artistId'] as String,
|
artistId: json['artistId'] as String,
|
||||||
year: (json['year'] as num).toInt(),
|
year: (json['year'] as num?)?.toInt(),
|
||||||
songCount: (json['songCount'] as num).toInt(),
|
songCount: (json['songCount'] as num).toInt(),
|
||||||
genres:
|
genres:
|
||||||
(json['genres'] as List<dynamic>).map((e) => e as String).toList(),
|
(json['genres'] as List<dynamic>).map((e) => e as String).toList(),
|
||||||
|
|
Loading…
Reference in a new issue