Data.fromjson constructor Null safety

Data.fromjson(
  1. Map<String, dynamic> json
)

Implementation

Data.fromjson(Map<String, dynamic> json) {
  id = json['id'] ?? '';
  type = json['type'] ?? '';
  attributes = Attributes.fromJson(json['attributes']!);
  relationships = [];
  json['relationships']!.forEach((v) {
    relationships.add(Relationship.fromJson(v));
  });
}