Compare commits

..

2 commits

Author SHA1 Message Date
017c52f96d
fix: year can be null 2024-06-21 12:20:01 +02:00
4bc2ad1285
chore: add vscode launch config 2024-06-21 12:19:45 +02:00
3 changed files with 27 additions and 2 deletions

25
.vscode/launch.json vendored Normal file
View file

@ -0,0 +1,25 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "ocarina2",
"request": "launch",
"type": "dart"
},
{
"name": "ocarina2 (profile mode)",
"request": "launch",
"type": "dart",
"flutterMode": "profile"
},
{
"name": "ocarina2 (release mode)",
"request": "launch",
"type": "dart",
"flutterMode": "release"
},
]
}

View file

@ -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;

View file

@ -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(),