getChapters function Null safety

Future<ChapterData> getChapters(
  1. String mangaId,
  2. {List<String>? ids,
  3. String? title,
  4. List<String>? groups,
  5. String? uploader,
  6. String? volume,
  7. String? chapter,
  8. List<LanguageCodes>? translatedLanguage,
  9. List<LanguageCodes>? originalLanguage,
  10. List<LanguageCodes>? excludedOriginalLanguage,
  11. List<ContentRating>? contentRating,
  12. String? createdAtSince,
  13. String? updatedAtSince,
  14. String? publishedAtSince,
  15. String? includes,
  16. int? limit,
  17. int? offset}
)

gets limit number of chapters for the given mangaId or uuid Returns the manga data in a ChapterData class instance

Implementation

Future<ChapterData> getChapters(String mangaId,
    {List<String>? ids,
    String? title,
    List<String>? groups,
    String? uploader,
    String? volume,
    String? chapter,
    List<LanguageCodes>? translatedLanguage,
    List<LanguageCodes>? originalLanguage,
    List<LanguageCodes>? excludedOriginalLanguage,
    List<ContentRating>? contentRating,
    String? createdAtSince,
    String? updatedAtSince,
    String? publishedAtSince,
    String? includes,
    int? limit,
    int? offset}) async {
  var _chapterOffset = offset ?? 0;
  var _ChapterLimit = limit ?? 10;
  var response = await getChaptersResponse(
    mangaId,
    offset: _chapterOffset,
    limit: _ChapterLimit,
    ids: ids,
    title: title,
    groups: groups,
    uploader: uploader,
    volume: volume,
    chapter: chapter,
    translatedLanguage: translatedLanguage,
    originalLanguage: originalLanguage,
    excludedOriginalLanguage: excludedOriginalLanguage,
    contentRating: contentRating,
    createdAtSince: createdAtSince,
    updatedAtSince: updatedAtSince,
    publishedAtSince: publishedAtSince,
  );
  try {
    return ChapterData.fromJson(jsonDecode(response.body));
  } catch (e) {
    throw MangadexServerException(jsonDecode(response.body));
  }
}