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