getPlayingTrackInfo method

  1. @override
Future<SpotifyTrackInfo?> getPlayingTrackInfo()
override

Gets basic information about the currently playing track.

Returns null if no track is playing.

Implementation

@override
Future<SpotifyTrackInfo?> getPlayingTrackInfo() async {
  try {
    final Map? result = await _channel.invokeMapMethod(_Methods.getTrackInfo);
    if (result == null) return null;
    return SpotifyTrackInfo.fromMap(result);
  } catch (e) {
    return null;
  }
}