toJson method
Implementation
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
data['order'] = this.order;
data['gender_rate'] = this.genderRate;
data['capture_rate'] = this.captureRate;
data['base_happiness'] = this.baseHappiness;
data['is_baby'] = this.isBaby;
data['hatch_counter'] = this.hatchCounter;
data['has_gender_differences'] = this.hasGenderDifferences;
data['forms_switchable'] = this.formsSwitchable;
if (this.growthRate != null) {
data['growth_rate'] = this.growthRate!.toJson();
}
if (this.pokedexNumbers != null) {
data['pokedex_numbers'] =
this.pokedexNumbers!.map((v) => v.toJson()).toList();
}
if (this.eggGroups != null) {
data['egg_groups'] = this.eggGroups!.map((v) => v.toJson()).toList();
}
if (this.color != null) {
data['color'] = this.color!.toJson();
}
if (this.shape != null) {
data['shape'] = this.shape!.toJson();
}
if (this.evolvesFromSpecies != null) {
data['evolves_from_species'] = this.evolvesFromSpecies!.toJson();
}
if (this.evolutionChain != null) {
data['evolution_chain'] = this.evolutionChain!.toJson();
}
data['habitat'] = this.habitat;
if (this.generation != null) {
data['generation'] = this.generation!.toJson();
}
if (this.names != null) {
data['names'] = this.names!.map((v) => v.toJson()).toList();
}
if (this.flavorTextEntries != null) {
data['flavor_text_entries'] =
this.flavorTextEntries!.map((v) => v.toJson()).toList();
}
if (this.formDescriptions != null) {
data['form_descriptions'] =
this.formDescriptions!.map((v) => v.toJson()).toList();
}
if (this.genera != null) {
data['genera'] = this.genera!.map((v) => v.toJson()).toList();
}
if (this.varieties != null) {
data['varieties'] = this.varieties!.map((v) => v.toJson()).toList();
}
return data;
}