getChapterDataByChapterId function Null safety

Future<SingleChapterData> getChapterDataByChapterId(
  1. String chapterId
)

gets details of a manga with the given chapterId or uuid Returns the manga data in a SingleChapterData class instance

Implementation

Future<SingleChapterData> getChapterDataByChapterId(String chapterId) async {
  var unencodedPath = '/at-home/server/$chapterId';
  var response = await http.get(Uri.https(authority, unencodedPath));
  try {
    return SingleChapterData.fromJson(jsonDecode(response.body));
  } on Exception {
    throw MangadexServerException(jsonDecode(response.body));
  }
}