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}
)

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,
  );
  var headers = response.headers;
  if (headers['x-ratelimit-remaining'] == '0') {
    print('Rate Limit Exceeded.');
  } else {
    var data = ChapterData.fromJson(jsonDecode(response.body));
    if (data.data.isNotEmpty) {
      return data;
    } else {
      print(
          'chapter with the manga ID $mangaId not found. Make sure the manga id isn\'t an empty String.');
    }
  }
}