SingleChapterData.fromJson constructor Null safety

SingleChapterData.fromJson(
  1. Map<String, dynamic> json
)

Implementation

SingleChapterData.fromJson(Map<String, dynamic> json) {
  result = json['result'] ?? '';
  if (result == 'ok') {
    baseUrl = json['baseUrl'] ?? '';
    try {
      chapter = Chapter.fromJson(json['chapter']!);
    } catch (e) {
      throw MangadexServerException(json);
    }
  } else {
    throw MangadexServerException(json);
  }
}