getBlockedPlayers function

Future<List<String>> getBlockedPlayers(
  1. String accessToken
)

Gets the list of players this player has blocked. Chat messages or Realms notifications are hidden from blocked players.

Implementation

Future<List<String>> getBlockedPlayers(String accessToken) async {
  final headers = {
    'authorization': 'Bearer $accessToken',
  };
  final response = await request(
      http.get, _minecraftServicesApi, '/privacy/blocklist',
      headers: headers);

  if (response.statusCode == 401) {
    throw AuthException(AuthException.invalidCredentialsMessage);
  }
  final map = parseResponseMap(response);
  return List<String>.from(map['blockedProfiles']);
}