Search.fromJson constructor Null safety

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

Implementation

Search.fromJson(Map<String, dynamic> json) {
  result = json['result'] ?? '';
  if (result == 'ok') {
    response = json['response'] ?? '';
    data = <Data>[];
    json['data']!.forEach((v) {
      data.add(Data.fromJson(v));
    });

    limit = json['limit'] ?? 0;
    offset = json['offset'] ?? 0;
    total = json['total'] ?? 0;
  } else {
    throw MangadexServerException(json);
  }
}