@@ -25,6 +25,7 @@ class Song {
2525 final double ? replayGainTrackPeak;
2626 final double ? replayGainAlbumPeak;
2727 final List <ArtistRef >? artistParticipants;
28+ final DateTime ? created;
2829
2930 Song ({
3031 required this .id,
@@ -51,6 +52,7 @@ class Song {
5152 this .replayGainTrackPeak,
5253 this .replayGainAlbumPeak,
5354 this .artistParticipants,
55+ this .created,
5456 });
5557
5658 factory Song .fromJson (Map <String , dynamic > json) {
@@ -81,6 +83,9 @@ class Song {
8183 replayGainTrackPeak: (replayGain? ['trackPeak' ] as num ? )? .toDouble (),
8284 replayGainAlbumPeak: (replayGain? ['albumPeak' ] as num ? )? .toDouble (),
8385 artistParticipants: ArtistRef .parseList (json['artists' ]),
86+ created: json['created' ] != null
87+ ? DateTime .tryParse (json['created' ].toString ())
88+ : null ,
8489 );
8590 }
8691
@@ -111,6 +116,7 @@ class Song {
111116 },
112117 if (artistParticipants != null )
113118 'artists' : artistParticipants! .map ((a) => a.toJson ()).toList (),
119+ 'created' : created? .toIso8601String (),
114120 };
115121 }
116122
@@ -146,6 +152,7 @@ class Song {
146152 double ? replayGainTrackPeak,
147153 double ? replayGainAlbumPeak,
148154 List <ArtistRef >? artistParticipants,
155+ DateTime ? created,
149156 }) {
150157 return Song (
151158 id: id ?? this .id,
@@ -172,6 +179,7 @@ class Song {
172179 replayGainTrackPeak: replayGainTrackPeak ?? this .replayGainTrackPeak,
173180 replayGainAlbumPeak: replayGainAlbumPeak ?? this .replayGainAlbumPeak,
174181 artistParticipants: artistParticipants ?? this .artistParticipants,
182+ created: created ?? this .created,
175183 );
176184 }
177185}
0 commit comments