Type.fromJson constructor
Implementation
Type.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
damageRelations = json['damage_relations'] != null
? DamageRelations.fromJson(json['damage_relations'])
: null;
if (json['game_indices'] != null) {
gameIndices = <GameIndices>[];
json['game_indices'].forEach((v) {
gameIndices!.add( GameIndices.fromJson(v));
});
}
generation = json['generation'] != null
? NamedAPIResource.fromJson(json['generation'])
: null;
moveDamageClass = json['move_damage_class'] != null
? NamedAPIResource.fromJson(json['move_damage_class'])
: null;
if (json['names'] != null) {
names = <Names>[];
json['names'].forEach((v) {
names!.add( Names.fromJson(v));
});
}
if (json['pokemon'] != null) {
pokemon = <TypePokemon>[];
json['pokemon'].forEach((v) {
pokemon!.add( TypePokemon.fromJson(v));
});
}
if (json['moves'] != null) {
moves = <NamedAPIResource>[];
json['moves'].forEach((v) {
moves!.add( NamedAPIResource.fromJson(v));
});
}
}