changeSkin function
Change the skin with the texture of the skin at skinUrl
.
Implementation
Future<bool> changeSkin(Uri skinUrl, AccessToken accessToken,
[SkinModel skinModel = SkinModel.classic]) async {
final headers = {
'authorization': 'Bearer $accessToken',
};
final data = {
'variant': skinModel.toString().replaceFirst('SkinModel', ''),
'url': skinUrl,
};
final response = await requestBody(
http.post, _minecraftServicesApi, 'minecraft/profile/skins', data,
headers: headers);
switch (response.statusCode) {
case 401:
throw AuthException(AuthException.invalidCredentialsMessage);
}
return true;
}