getPlayerRatingLatest method
Requests the latest player rating PlayerRating from server.
Requires player identifier playerId
. Returns player rating object
PlayerRating in case of success or Null if player not found.
Throws DioError
in case of network connection problems.
Implementation
Future<PlayerRating?> getPlayerRatingLatest(String playerId) async {
final int id = playerId.parseIdOrThrow;
final Response<dynamic> response =
await _dio.get('/players.$extensionJson/$id/rating/last');
if (response.data is bool) {
return null;
} else {
return PlayerRating.fromMap(response.data);
}
}