Stat.fromJson constructor

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

Implementation

Stat.fromJson(Map<String, dynamic> json) {
  id = json['id'];
  name = json['name'];
  gameIndex = json['game_index'];
  isBattleOnly = json['is_battle_only'];
  affectingMoves = json['affecting_moves'] != null
      ? new AffectingMoves.fromJson(json['affecting_moves'])
      : null;
  affectingNatures = json['affecting_natures'] != null
      ? new AffectingNatures.fromJson(json['affecting_natures'])
      : null;
  if (json['characteristics'] != null) {
    characteristics = <Characteristics>[];
    json['characteristics'].forEach((v) {
      characteristics!.add(new Characteristics.fromJson(v));
    });
  }
  moveDamageClass = json['move_damage_class'] != null
      ? new NamedAPIResource.fromJson(json['move_damage_class'])
      : null;
  if (json['names'] != null) {
    names = <Names>[];
    json['names'].forEach((v) {
      names!.add(new Names.fromJson(v));
    });
  }
}