getTournamentResults method

Future<Iterable<TournamentResults>> getTournamentResults(
  1. int tournamentId
)

Requests tournament results TournamentResults from server.

Requires tournament identifier tournamentId. Returns tournament team results object TournamentResults list in case of success or empty list if tournament results not found. Throws DioError in case of network connection problems or ErrorResponse in case of parsable error

Implementation

Future<Iterable<TournamentResults>> getTournamentResults(
    int tournamentId) async {
  try {
    final Response<List<dynamic>> response =
        await _dio.get('/tournaments/$tournamentId/results');
    return TournamentResults.decodeList(response.data!);
  } on DioError catch (e) {
    try {
      throw ErrorResponse.fromRawJson(e.response?.data);
    } on TypeError catch (_) {
      throw e;
    }
  }
}