checkFollowing method

Future<Map<String, bool>> checkFollowing(
  1. FollowingType type,
  2. List<String> ids
)

Check if current user follow the provided FollowingType.artists or FollowingType.users.

Returns the list of ids mapped with the response whether it has been followed or not

Implementation

Future<Map<String, bool>> checkFollowing(
    FollowingType type, List<String> ids) async {
  assert(ids.isNotEmpty, 'No user/artist id was provided');

  final jsonString =
      await _api._get('$_path/following/contains?${_buildQuery({
        'type': type._key,
        'ids': ids.join(','),
      })}');
  final list = List.castFrom<dynamic, bool>(json.decode(jsonString));
  return Map.fromIterables(ids, list);
}