getTimings method

Future<List<Object>>? getTimings(
  1. int malId,
  2. int episode,
  3. double episodeDuration
)

Implementation

Future<List<Object>>? getTimings(
    int malId, int episode, double episodeDuration) async {
  try {
    final response = await Dio().get(
        "https://api.aniskip.com/v2/skip-times/$malId/$episode?types[]=ed&types[]=mixed-ed&types[]=mixed-op&types[]=op&types[]=recap&episodeLength=$episodeDuration");
    return response.data["results"];
  } on DioException catch (e) {
    if (!e.response!.data["found"]) {
      throw NotFoundException(
          "Not found. May be you're provided bad malId, episode or episodeDuration.");
    } else {
      throw BadResponseException("An error has occurred");
    }
  }
}