Nature.fromJson constructor

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

Implementation

Nature.fromJson(Map<String, dynamic> json) {
  id = json['id'];
  name = json['name'];
  decreasedStat = json['decreased_stat'] != null
      ?  NamedAPIResource.fromJson(json['decreased_stat'])
      : null;
  increasedStat = json['increased_stat'] != null
      ?  NamedAPIResource.fromJson(json['increased_stat'])
      : null;
  likesFlavor = json['likes_flavor'] != null
      ?  NamedAPIResource.fromJson(json['likes_flavor'])
      : null;
  hatesFlavor = json['hates_flavor'] != null
      ?  NamedAPIResource.fromJson(json['hates_flavor'])
      : null;
  if (json['pokeathlon_stat_changes'] != null) {
    pokeathlonStatChanges =  <PokeathlonStatChanges>[];
    json['pokeathlon_stat_changes'].forEach((v) {
      pokeathlonStatChanges!.add( PokeathlonStatChanges.fromJson(v));
    });
  }
  if (json['move_battle_style_preferences'] != null) {
    moveBattleStylePreferences =  <MoveBattleStylePreferences>[];
    json['move_battle_style_preferences'].forEach((v) {
      moveBattleStylePreferences!
          .add( MoveBattleStylePreferences.fromJson(v));
    });
  }
  if (json['names'] != null) {
    names =  <Names>[];
    json['names'].forEach((v) {
      names!.add( Names.fromJson(v));
    });
  }
}