getTournamentDetails method
Requests tournament details Tournament
from server.
Requires tournament identifier tournamentId
. Returns tournament details
object Tournament
in case of success or Null
if team tournament not found.
Throws DioError
in case of network connection problems or
ErrorResponse
in case of parsable error
Implementation
Future<Tournament> getTournamentDetails(int tournamentId) async {
try {
final Response<String> response =
await _dio.get('/tournaments/$tournamentId');
return Tournament.fromRawJson(response.data!);
} on DioError catch (e) {
try {
throw ErrorResponse.fromRawJson(e.response?.data);
} on TypeError catch (_) {
throw e;
}
}
}