canMigrate function

Future<bool> canMigrate(
  1. AccessToken accessToken
)

Checks whether this user can already migrate their account from a Mojang account to a Microsoft account. This function will simply return 'false' if the access token is invalid or expired.

Implementation

Future<bool> canMigrate(AccessToken accessToken) async {
  final response = await request(
      http.get, _minecraftServicesApi, 'rollout/v1/msamigration',
      headers: {
        'authorization': 'Bearer $accessToken',
      });
  if (response.statusCode == 401) {
    return false;
  }

  final map = parseResponseMap(response);
  return map['rollout'] != null && map['rollout'] as bool;
}