getMangaDataByMangaId function Null safety

Future<SingleMangaData> getMangaDataByMangaId(
  1. String mangaId
)

gets details of a manga with the given mangaId or uuid Returns the manga data in a SingleMangaData class instance

Implementation

Future<SingleMangaData> getMangaDataByMangaId(String mangaId) async {
  var unencodedPath = '/manga/$mangaId';
  var response = await http.get(Uri.http(authority, unencodedPath));
  try {
    return SingleMangaData.fromJson(jsonDecode(response.body));
  } on Exception {
    throw MangadexServerException(jsonDecode(response.body));
  }
}