getProfile function

Future<Profile> getProfile(
  1. String uuid
)

Returns the user profile including skin/cape information. Does not require authentication.

Using getProfile(uuid).getTextures both skin and cape textures can be obtained.

Implementation

Future<Profile> getProfile(String uuid) async {
  final response =
      await request(http.get, _sessionApi, 'session/minecraft/profile/$uuid');
  final map = parseResponseMap(response);
  if (response.statusCode == 400 || response.statusCode == 404) {
    throw ArgumentError.value(
        uuid, 'uuid', 'User for given UUID could not be found or is invalid.');
  } else if (response.statusCode == 429 && map['error'] != null) {
    throw TooManyRequestsException(map['errorMessage']);
  }
  return Profile.fromLegacyJson(map);
}