getChapters function Null safety
- String mangaId
Implementation
Future<ChapterData?> getChapters(String mangaId) async {
var response = await getChaptersResponse(mangaId);
var headers = response.headers;
if (headers['x-ratelimit-remaining'] == '0') {
print('Rate Limit Exceeded.');
} else {
var data = ChapterData.fromJson(jsonDecode(response.body));
if (data.result.isNotEmpty) {
return data;
} else {
print(
'chapter with the manga ID $mangaId not found. Make sure the manga id isn\'t an empty String.');
}
}
}