getTeamRatingList method
Requests historical team ratings TeamRating list from server.
Requires team identifier teamId
. Returns team rating objects
TeamRating list in case of success or empty list if team rating not found.
Throws DioError
in case of network connection problems.
Implementation
Future<Iterable<TeamRating>> getTeamRatingList(String teamId) async {
final int id = teamId.parseIdOrThrow;
try {
final Response<dynamic> response =
await _dio.get('/teams.$extensionJson/$id/rating');
return (response.data as List<dynamic>)
.map((dynamic e) => TeamRating.fromMap(e));
} on DioError catch (e) {
if (e.message.isNotFoundError) {
return <TeamRating>[];
} else {
rethrow;
}
}
}