getTeamTournamentLast method

Future<TeamTournament?> getTeamTournamentLast(
  1. String teamId
)

Requests the latest team tournament TeamTournament from server.

Requires team identifier teamId. Returns team tournament object TeamTournament in case of success or Null if team tournament not found. Throws DioError in case of network connection problems.

Implementation

Future<TeamTournament?> getTeamTournamentLast(String teamId) async {
  final int id = teamId.parseIdOrThrow;
  try {
    final Response<dynamic> response =
        await _dio.get('/teams.$extensionJson/$id/tournaments/last');
    return TeamTournament.fromMap(response.data);
  } on DioError catch (e) {
    if (e.message.isNotFoundError) {
      return null;
    } else {
      rethrow;
    }
  }
}