getSecurityChallenges function Null safety

Future<List<SecurityChallenge>> getSecurityChallenges(
  1. String accessToken

Fetches the list of security challenges one must answer to access the account. Check if this is needed using areSecurityChallengesNeeded.


Future<List<SecurityChallenge>> getSecurityChallenges(
    String accessToken) async {
  final headers = {
    'authorization': 'Bearer $accessToken',
  final response = await request(
      http.get, _mojangApi, 'user/security/challenges',
      headers: headers);
  if (response.statusCode == 401) {
    throw AuthException(AuthException.invalidCredentialsMessage);
  final list = parseResponseList(response);
  return => SecurityChallenge.fromJson(f)).toList();