currentUserFollowsPlaylist method

Future<bool> currentUserFollowsPlaylist(
  1. String playlistId
)

Checks if the current user follows a given playlist.

Implementation

Future<bool> currentUserFollowsPlaylist(String playlistId) async {
  final currentUser = await getCurrentUser();

  final params = {'ids': currentUser.id};
  final url = Uri.https(
    _baseApiHost,
    '/v1/playlists/$playlistId/followers/contains',
    params,
  );

  final List<dynamic> json = await _getJson(url);
  return json.isNotEmpty && json[0] == true;
}