getRecentTracks static method
Fetches a list of PlayedSongs.
This method will only return songs that are stored on the user's device, and it will only return a song once, even if the user played it multiple times.
If after
is specified, only songs that were last played after after
will be returned.
Implementation
static Future<List<PlayedSong>> getRecentTracks({
DateTime? after,
required int limit,
required int page,
}) async {
final jsonString = await _channel.invokeMethod<String>('getRecentTracks',
{'after': after?.millisecondsSinceEpoch, 'limit': limit, 'page': page});
if (jsonString == null) {
throw PlatformException(code: "NULL_RESPONSE");
}
final jsonObject = json.decode(jsonString) as List<dynamic>;
return jsonObject.map(PlayedSong.fromJson).toList(growable: false);
}