Move.fromJson constructor

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

Implementation

Move.fromJson(Map<String, dynamic> json) {
  generation = json['generation'] != null
      ?  NamedAPIResource.fromJson(json['generation'])
      : null;
  pp = json['pp'];
  if (json['stat_changes'] != null) {
    statChanges = <NamedAPIResource>[];
  }
  accuracy = json['accuracy'];
  contestCombos = json['contest_combos'] != null
      ?  MoveContestCombos.fromJson(json['contest_combos'])
      : null;
  priority = json['priority'];
  superContestEffect = json['super_contest_effect'] != null
      ?  NamedAPIResource.fromJson(json['super_contest_effect'])
      : null;
  type = json['type'] != null
      ?  NamedAPIResource.fromJson(json['type'])
      : null;
  if (json['effect_changes'] != null) {
    effectChanges = <NamedAPIResource>[];
  }
  target = json['target'] != null
      ?  NamedAPIResource.fromJson(json['target'])
      : null;
  if (json['effect_entries'] != null) {
    effectEntries = <MoveEffectEntry>[];
    (json['effect_entries'] as List).forEach((v) {
      effectEntries!.add( MoveEffectEntry.fromJson(v));
    });
  }
  contestType = json['contest_type'] != null
      ?  NamedAPIResource.fromJson(json['contest_type'])
      : null;
  if (json['past_values'] != null) {
    pastValues = <NamedAPIResource>[];
  }
  if (json['names'] != null) {
    names = <MoveName>[];
    (json['names'] as List).forEach((v) {
      names!.add( MoveName.fromJson(v));
    });
  }
  meta = json['meta'] != null ?  MoveMeta.fromJson(json['meta']) : null;
  if (json['flavor_text_entries'] != null) {
    flavorTextEntries = <MoveFlavorTextEntry>[];
    (json['flavor_text_entries'] as List).forEach((v) {
      flavorTextEntries!.add( MoveFlavorTextEntry.fromJson(v));
    });
  }
  damageClass = json['damage_class'] != null
      ?  NamedAPIResource.fromJson(json['damage_class'])
      : null;
  name = json['name'];
  effectChance = json['effect_chance'];
  id = json['id'];
  if (json['machines'] != null) {
    machines = <NamedAPIResource>[];
  }
  power = json['power'];
  contestEffect = json['contest_effect'] != null
      ?  NamedAPIResource.fromJson(json['contest_effect'])
      : null;
}