diff --git a/lib/ability.dart b/lib/ability.dart index 6881ef1..869e07e 100644 --- a/lib/ability.dart +++ b/lib/ability.dart @@ -28,15 +28,6 @@ class PokemonAbility with ResourceBase { ability: AbilityResource.fromJson(json['ability']), ); } - - @override - Map toJson() { - return { - 'is_hidden': isHidden, - 'slot': slot, - 'ability': ability.toJson(), - }; - } } class Ability with ResourceBase { @@ -81,21 +72,6 @@ class Ability with ResourceBase { pokemon: json['pokemon'].map((e) => AbilityPokemon.fromJson(e)).toList(), ); } - - @override - Map toJson() { - return { - 'id': id, - 'name': name, - 'is_main_series': isMainSeries, - 'generation': generation.toJson(), - 'names': names.map((e) => e.toJson()).toList(), - 'effect_entries': effectEntries.map((e) => e.toJson()).toList(), - 'effect_changes': effectChanges.map((e) => e.toJson()).toList(), - 'flavor_text_entries': flavorTextEntries.map((e) => e.toJson()).toList(), - 'pokemon': pokemon.map((e) => e.toJson()).toList(), - }; - } } class AbilityPokemon with ResourceBase { @@ -121,15 +97,6 @@ class AbilityPokemon with ResourceBase { pokemon: PokemonResource.fromJson(json['pokemon']), ); } - - @override - Map toJson() { - return { - 'is_hidden': isHidden, - 'slot': slot, - 'pokemon': pokemon.toJson(), - }; - } } class AbilityFlavorText with ResourceBase { @@ -155,15 +122,6 @@ class AbilityFlavorText with ResourceBase { versionGroup: NamedAPIResource.fromJson(json['version_group']), ); } - - @override - Map toJson() { - return { - 'flavor_text': flavorText, - 'language': language.toJson(), - 'version_group': versionGroup.toJson(), - }; - } } class AbilityEffectChange with ResourceBase { @@ -185,14 +143,6 @@ class AbilityEffectChange with ResourceBase { versionGroup: NamedAPIResource.fromJson(json['version_group']), ); } - - @override - Map toJson() { - return { - 'effect_entries': effectEntries.map((e) => e.toJson()).toList(), - 'version_group': versionGroup.toJson(), - }; - } } class VerboseEffect with ResourceBase { @@ -218,15 +168,6 @@ class VerboseEffect with ResourceBase { language: NamedAPIResource.fromJson(json['language']), ); } - - @override - Map toJson() { - return { - 'effect': effect, - 'short_effect': shortEffect, - 'language': language.toJson(), - }; - } } class AbilityResource extends NamedAPIResource { @@ -244,13 +185,6 @@ class AbilityResource extends NamedAPIResource { ); } - @override - Map toJson() { - return { - 'name': name, - }; - } - @override Ability mapper(dynamic data) { return Ability.fromJson(data); diff --git a/lib/base.dart b/lib/base.dart index ef13f12..ede1fdd 100644 --- a/lib/base.dart +++ b/lib/base.dart @@ -15,6 +15,6 @@ mixin ResourceBase { return '$runtimeType${toJson()}'; } - Map toJson(); + Map toJson() => rawData; } diff --git a/lib/cache.dart b/lib/cache.dart index c418698..af04858 100644 --- a/lib/cache.dart +++ b/lib/cache.dart @@ -21,7 +21,7 @@ abstract class CacheManager { T Function(dynamic data)? onResult, int? retry, }) async { - final _retry = retry ?? 3; + final remainingRetries = retry ?? 3; Response? response; try { final mapper = onResult ?? ((data) => data); @@ -34,8 +34,8 @@ abstract class CacheManager { add(key, response.data); return value; } catch (e, stack) { - if (_retry > 0) { - return getOne(key, onResult: onResult, retry: _retry - 1); + if (remainingRetries > 0) { + return getOne(key, onResult: onResult, retry: remainingRetries - 1); } remove(key); print('Error getting $key: $e.\nResponse: $response'); diff --git a/lib/characteristic.dart b/lib/characteristic.dart index 91aa797..b1efb2d 100644 --- a/lib/characteristic.dart +++ b/lib/characteristic.dart @@ -31,15 +31,4 @@ class Characteristic with ResourceBase { highestStat: NamedAPIResource.fromJson(json['highest_stat']), ); } - - @override - Map toJson() { - return { - 'id': id, - 'gene_modulo': geneModulo, - 'possible_values': possibleValues, - 'descriptions': descriptions.map((e) => e.toJson()).toList(), - 'highest_stat': highestStat.toJson(), - }; - } } diff --git a/lib/description.dart b/lib/description.dart index 028330b..265b76b 100644 --- a/lib/description.dart +++ b/lib/description.dart @@ -21,11 +21,5 @@ class Description with ResourceBase { language: NamedAPIResource.fromJson(json['language']), ); } - - @override - Map toJson() => { - 'description': description, - 'language': language.toJson(), - }; } diff --git a/lib/encounter.dart b/lib/encounter.dart index f2e2292..ecf0620 100644 --- a/lib/encounter.dart +++ b/lib/encounter.dart @@ -169,14 +169,6 @@ class EncounterMethodRate with ResourceBase { json['version_details'].map((e) => EncounterVersionDetails.fromJson(e)).toList(), ); } - - @override - Map toJson() { - return { - 'encounter_method': encounterMethod.toJson(), - 'version_details': versionDetails.map((e) => e.toJson()).toList(), - }; - } } class EncounterVersionDetails with ResourceBase { @@ -201,13 +193,5 @@ class EncounterVersionDetails with ResourceBase { version: NamedAPIResource.fromJson(json['version']), ); } - - @override - Map toJson() { - return { - 'rate': rate, - 'version': version.toJson(), - }; - } } diff --git a/lib/flavor_text.dart b/lib/flavor_text.dart index 47f3f4b..56cba68 100644 --- a/lib/flavor_text.dart +++ b/lib/flavor_text.dart @@ -24,13 +24,6 @@ class FlavorText with ResourceBase { version: NamedAPIResource.fromJson(json['version']), ); } - - @override - Map toJson() => { - 'flavor_text': flavorText, - 'language': language.toJson(), - 'version': version.toJson(), - }; } class MoveFlavorText with ResourceBase { @@ -56,11 +49,4 @@ class MoveFlavorText with ResourceBase { versionGroup: NamedAPIResource.fromJson(json['version_group']), ); } - - @override - Map toJson() => { - 'flavor_text': flavorText, - 'language': language.toJson(), - 'version_group': versionGroup.toJson(), - }; } diff --git a/lib/generation.dart b/lib/generation.dart index efa4c36..c576d66 100644 --- a/lib/generation.dart +++ b/lib/generation.dart @@ -43,19 +43,6 @@ class Generation with ResourceBase { versionGroups: json['version_groups'].map((e) => NamedAPIResource.fromJson(e)).toList(), ); } - - @override - Map toJson() => { - 'id': id, - 'name': name, - 'abilities': abilities.map((e) => e.toJson()).toList(), - 'names': names.map((e) => e.toJson()).toList(), - 'main_region': mainRegion.toJson(), - 'moves': moves.map((e) => e.toJson()).toList(), - 'pokemon_species': pokemonSpecies.map((e) => e.toJson()).toList(), - 'types': types.map((e) => e.toJson()).toList(), - 'version_groups': versionGroups.map((e) => e.toJson()).toList(), - }; } class GenerationResource extends NamedAPIResource { diff --git a/lib/generation_game_index.dart b/lib/generation_game_index.dart index a155638..a220cd1 100644 --- a/lib/generation_game_index.dart +++ b/lib/generation_game_index.dart @@ -22,11 +22,5 @@ class GenerationGameIndex with ResourceBase { gameIndex: json['game_index'], generation: NamedAPIResource.fromJson(json['generation']), ); - - @override - Map toJson() => { - 'game_index': gameIndex, - 'generation': generation.toJson(), - }; } diff --git a/lib/genus.dart b/lib/genus.dart index 36b5842..8cc9a74 100644 --- a/lib/genus.dart +++ b/lib/genus.dart @@ -21,11 +21,5 @@ class Genus with ResourceBase { language: NamedAPIResource.fromJson(json['language']), ); } - - @override - Map toJson() => { - 'genus': genus, - 'language': language.toJson(), - }; } diff --git a/lib/held_item.dart b/lib/held_item.dart index 27825ef..c2eab36 100644 --- a/lib/held_item.dart +++ b/lib/held_item.dart @@ -44,11 +44,5 @@ class PokemonHeldItemVersion with ResourceBase { version: NamedAPIResource.fromJson(json["version"]), rarity: json["rarity"], ); - - @override - Map toJson() => { - "version": version.toJson(), - "rarity": rarity, - }; } diff --git a/lib/language.dart b/lib/language.dart index 5e40910..9c295e8 100644 --- a/lib/language.dart +++ b/lib/language.dart @@ -34,18 +34,6 @@ class Language with ResourceBase { names: json['names'].map((e) => Name.fromJson(e)).toList(), ); } - - @override - Map toJson() { - return { - 'id': id, - 'name': name, - 'official': official, - 'iso639': iso639, - 'iso3166': iso3166, - 'names': names.map((e) => e.toJson()).toList(), - }; - } } class LanguageResource extends NamedAPIResource { diff --git a/lib/location.dart b/lib/location.dart index c642119..1ac0b9c 100644 --- a/lib/location.dart +++ b/lib/location.dart @@ -35,18 +35,6 @@ class Location with ResourceBase { gameIndices: json['game_indices'].map((e) => GenerationGameIndex.fromJson(e)).toList(), ); } - - @override - Map toJson() { - return { - 'id': id, - 'name': name, - 'names': names.map((e) => e.toJson()).toList(), - 'region': region.toJson(), - 'areas': areas.map((e) => e.toJson()).toList(), - 'game_indices': gameIndices.map((e) => e.toJson()).toList(), - }; - } } class LocationResource extends NamedAPIResource { diff --git a/lib/location_area.dart b/lib/location_area.dart index 7a0d174..0207615 100644 --- a/lib/location_area.dart +++ b/lib/location_area.dart @@ -63,16 +63,6 @@ class LocationArea with ResourceBase { json['encounter_method_rates'].map((e) => EncounterMethodRate.fromJson(e)).toList(), ); } - - @override - Map toJson() { - return { - 'game_index': gameIndex, - 'location': location.toJson(), - 'names': names.map((e) => e.toJson()).toList(), - 'pokemon_encounters': pokemonEncounters.map((e) => e.toJson()).toList(), - }; - } } class PokemonLocationAreaResource extends APIResource> { diff --git a/lib/move.dart b/lib/move.dart index 00fe40e..46c44b0 100644 --- a/lib/move.dart +++ b/lib/move.dart @@ -27,14 +27,6 @@ class PokemonMove with ResourceBase { ((json['version_group_details'] ?? []) as List).map((e) => PokemonMoveVersion.fromJson(e)).toList(), ); } - - @override - Map toJson() { - return { - 'move': move?.toJson(), - 'version_group_details': versionGroupDetails.map((e) => e.toJson()).toList(), - }; - } } class Move with ResourceBase { @@ -58,7 +50,7 @@ class Move with ResourceBase { final List names; final PastMoveStatValues pastValues; final List statChanges; - final dynamic superContestEffect; + final NamedAPIResource superContestEffect; final NamedAPIResource? target; final NamedAPIResource? type; @@ -117,40 +109,12 @@ class Move with ResourceBase { names: (json['names'] as List).map((e) => Name.fromJson(e)).toList(), pastValues: PastMoveStatValues.fromJson(json['past_values']), statChanges: json['stat_changes'], - superContestEffect: json['super_contest_effect'], + superContestEffect: NamedAPIResource.fromJson(json['super_contest_effect']), target: json['target'] != null ? NamedAPIResource.fromJson(json['target']) : null, type: json['type'] != null ? NamedAPIResource.fromJson(json['type']) : null, ); } - @override - Map toJson() { - return { - 'id': id, - 'name': name, - 'accuracy': accuracy, - 'effect_chance': effectChance, - 'pp': pp, - 'priority': priority, - 'power': power, - 'contest_combos': contestCombos?.toJson(), - 'contest_type': contestType?.toJson(), - 'contest_effect': contestEffect?.toJson(), - 'damage_class': damageClass?.toJson(), - 'effect_entries': effectEntries.map((e) => e.toJson()).toList(), - 'effect_changes': effectChanges.map((e) => e.toJson()).toList(), - 'flavor_text_entries': flavorTextEntries, - 'generation': generation?.toJson(), - 'machines': machines, - 'meta': metaData, - 'names': names.map((e) => e.toJson()).toList(), - 'past_values': pastValues, - 'stat_changes': statChanges, - 'super_contest_effect': superContestEffect, - 'target': target?.toJson(), - 'type': type?.toJson(), - }; - } } class MoveResource extends NamedAPIResource { @@ -164,14 +128,6 @@ class MoveResource extends NamedAPIResource { ); } - @override - Map toJson() { - return { - 'name': name, - 'url': url, - }; - } - @override Move mapper(data) => Move.fromJson(data); } @@ -187,20 +143,12 @@ class PokemonMoveResource extends NamedAPIResource { ); } - @override - Map toJson() { - return { - 'name': name, - 'url': url, - }; - } - @override PokemonMove mapper(data) => PokemonMove.fromJson(data); } class PokemonMoveVersion with ResourceBase { - final NamedAPIResource? versionGroup; + final VersionGroupResource? versionGroup; final int? levelLearnedAt; final MoveLearnMethodResource? moveLearnMethod; @override @@ -216,21 +164,12 @@ class PokemonMoveVersion with ResourceBase { factory PokemonMoveVersion.fromJson(Map json) { return PokemonMoveVersion( rawData: json, - versionGroup: json['version_group'] != null ? NamedAPIResource.fromJson(json['version_group']) : null, + versionGroup: json['version_group'] != null ? VersionGroupResource.fromJson(json['version_group']) : null, levelLearnedAt: json['level_learned_at'], moveLearnMethod: json['move_learn_method'] != null ? MoveLearnMethodResource.fromJson(json['move_learn_method']) : null, ); } - - @override - Map toJson() { - return { - 'version_group': versionGroup?.toJson(), - 'level_learned_at': levelLearnedAt, - 'move_learn_method': moveLearnMethod?.toJson(), - }; - } } class MoveLearnMethod with ResourceBase { @@ -262,17 +201,6 @@ class MoveLearnMethod with ResourceBase { descriptions: (json['descriptions'] as List).map((e) => Description.fromJson(e)).toList(), ); } - - @override - Map toJson() { - return { - 'id': id, - 'name': name, - 'names': names.map((e) => e.toJson()).toList(), - 'version_groups': versionGroups.map((e) => e.toJson()).toList(), - 'descriptions': descriptions.map((e) => e.toJson()).toList(), - }; - } } class PokemonMoveVersionResource extends NamedAPIResource { @@ -352,17 +280,4 @@ class PastMoveStatValues with ResourceBase { versionGroup: json['version_group'] != null ? VersionGroupResource.fromJson(json['version_group']) : null, ); } - - @override - Map toJson() { - return { - 'accuracy': accuracy, - 'effect_chance': effectChance, - 'power': power, - 'pp': pp, - 'effect_entries': effectEntries, - 'type': type?.toJson(), - 'version_group': versionGroup?.toJson(), - }; - } } diff --git a/lib/move_battle_style_preference.dart b/lib/move_battle_style_preference.dart index 71aede4..9200c93 100644 --- a/lib/move_battle_style_preference.dart +++ b/lib/move_battle_style_preference.dart @@ -59,14 +59,5 @@ class MoveBattleStyle with ResourceBase { names: json['names'].map((e) => Name.fromJson(e)).toList(), ); } - - @override - Map toJson() { - return { - 'id': id, - 'name': name, - 'names': names.map((e) => e.toJson()).toList(), - }; - } } diff --git a/lib/move_damage_class.dart b/lib/move_damage_class.dart index 2bb311c..1026d5c 100644 --- a/lib/move_damage_class.dart +++ b/lib/move_damage_class.dart @@ -33,17 +33,6 @@ class MoveDamageClass with ResourceBase { names: json['names'].map((e) => Name.fromJson(e)).toList(), ); } - - @override - Map toJson() { - return { - 'id': id, - 'name': name, - 'descriptions': descriptions.map((e) => e.toJson()).toList(), - 'moves': moves.map((e) => e.toJson()).toList(), - 'names': names.map((e) => e.toJson()).toList(), - }; - } } class MoveDamageClassResource extends NamedAPIResource { diff --git a/lib/move_stat_affect.dart b/lib/move_stat_affect.dart index 10d01f7..6dcebfe 100644 --- a/lib/move_stat_affect.dart +++ b/lib/move_stat_affect.dart @@ -22,14 +22,6 @@ class MoveStatAffectSets with ResourceBase { decrease: json['decrease'].map((e) => MoveStatAffect.fromJson(e)).toList(), ); } - - @override - Map toJson() { - return { - 'increase': increase.map((e) => e.toJson()).toList(), - 'decrease': decrease.map((e) => e.toJson()).toList(), - }; - } } class MoveStatAffect with ResourceBase { @@ -52,12 +44,4 @@ class MoveStatAffect with ResourceBase { move: MoveResource.fromJson(json['move']), ); } - - @override - Map toJson() { - return { - 'change': change, - 'move': move.toJson(), - }; - } } diff --git a/lib/name.dart b/lib/name.dart index 4a6c464..152bf7e 100644 --- a/lib/name.dart +++ b/lib/name.dart @@ -20,13 +20,5 @@ class Name with ResourceBase { language: NamedAPIResource.fromJson(json['language']), ); } - - @override - Map toJson() { - return { - 'name': name, - 'language': language.toJson(), - }; - } } diff --git a/lib/named_api_resource.dart b/lib/named_api_resource.dart index 4dc0b35..86238ec 100644 --- a/lib/named_api_resource.dart +++ b/lib/named_api_resource.dart @@ -11,23 +11,10 @@ class APIResource with ResourceBase { }); factory APIResource.fromJson(Map json) { - try { - return APIResource( - rawData: json, - url: json['url'], - ); - } catch (e, stack) { - print('Error parsing APIResource: $e, json: $json'); - print(stack); - rethrow; - } - } - - @override - Map toJson() { - return { - 'url': url, - }; + return APIResource( + rawData: json, + url: json['url'], + ); } T mapper(dynamic data) { @@ -53,25 +40,11 @@ class NamedAPIResource extends APIResource { }); factory NamedAPIResource.fromJson(Map json) { - try { - return NamedAPIResource( - rawData: json, - name: json['name'], - url: json['url'], - ); - } catch (e, stack) { - print('Error parsing NamedAPIResource: $e, json: $json'); - print(stack); - rethrow; - } - } - - @override - Map toJson() { - return { - 'name': name, - 'url': url, - }; + return NamedAPIResource( + rawData: json, + name: json['name'], + url: json['url'], + ); } } diff --git a/lib/nature.dart b/lib/nature.dart index 0f6aec0..2e6a809 100644 --- a/lib/nature.dart +++ b/lib/nature.dart @@ -45,19 +45,4 @@ class Nature with ResourceBase { names: json['names'].map((e) => Name.fromJson(e)).toList(), ); } - - @override - Map toJson() { - return { - 'id': id, - 'name': name, - 'decreased_stat': decreasedStat.toJson(), - 'increased_stat': increasedStat.toJson(), - 'hates_flavor': hatesFlavor.toJson(), - 'likes_flavor': likesFlavor.toJson(), - 'pokeathlon_stat_changes': pokeathlonStatChanges.map((e) => e.toJson()).toList(), - 'move_battle_style_preferences': moveBattleStylePreferences.map((e) => e.toJson()).toList(), - 'names': names.map((e) => e.toJson()).toList(), - }; - } } diff --git a/lib/nature_stat_affect.dart b/lib/nature_stat_affect.dart index 300c895..2fbe058 100644 --- a/lib/nature_stat_affect.dart +++ b/lib/nature_stat_affect.dart @@ -22,14 +22,6 @@ class NatureStatAffectSets with ResourceBase { decrease: json['decrease'].map((e) => NamedAPIResource.fromJson(e)).toList(), ); } - - @override - Map toJson() { - return { - 'increase': increase.map((e) => e.toJson()).toList(), - 'decrease': decrease.map((e) => e.toJson()).toList(), - }; - } } class NatureStatChange with ResourceBase { @@ -52,14 +44,6 @@ class NatureStatChange with ResourceBase { pokeathlonStat: NamedAPIResource.fromJson(json['pokeathlon_stat']), ); } - - @override - Map toJson() { - return { - 'max_change': maxChange, - 'pokeathlon_stat': pokeathlonStat.toJson(), - }; - } } class PokeathlonStat with ResourceBase { @@ -88,16 +72,6 @@ class PokeathlonStat with ResourceBase { affectingNatures: NaturePokeathlonStatAffectSets.fromJson(json['affecting_natures']), ); } - - @override - Map toJson() { - return { - 'id': id, - 'name': name, - 'names': names, - 'affecting_natures': affectingNatures.toJson(), - }; - } } class NaturePokeathlonStatAffectSets with ResourceBase { @@ -120,14 +94,6 @@ class NaturePokeathlonStatAffectSets with ResourceBase { decrease: json['decrease'].map((e) => NaturePokeathlonStatAffect.fromJson(e)).toList(), ); } - - @override - Map toJson() { - return { - 'increase': increase.map((e) => e.toJson()).toList(), - 'decrease': decrease.map((e) => e.toJson()).toList(), - }; - } } class NaturePokeathlonStatAffect with ResourceBase { @@ -150,14 +116,6 @@ class NaturePokeathlonStatAffect with ResourceBase { nature: NamedAPIResource.fromJson(json['nature']), ); } - - @override - Map toJson() { - return { - 'max_change': maxChange, - 'nature': nature.toJson(), - }; - } } class NatureResource extends NamedAPIResource { diff --git a/lib/pal_park_encounter_area.dart b/lib/pal_park_encounter_area.dart index 26d7348..42f9a03 100644 --- a/lib/pal_park_encounter_area.dart +++ b/lib/pal_park_encounter_area.dart @@ -24,12 +24,5 @@ class PalParkEncounterArea with ResourceBase { area: NamedAPIResource.fromJson(json['area']), ); } - - @override - Map toJson() => { - 'base_score': baseScore, - 'rate': rate, - 'area': area.toJson(), - }; } diff --git a/lib/past_type.dart b/lib/past_type.dart index 8ed595e..7ee7bee 100644 --- a/lib/past_type.dart +++ b/lib/past_type.dart @@ -21,13 +21,5 @@ class PokemonTypePast with ResourceBase { types: json['types'].map((e) => PokemonType.fromJson(e)).toList(), ); } - - @override - Map toJson() { - return { - 'generation': generation.toJson(), - 'types': types.map((e) => e.toJson()).toList(), - }; - } } diff --git a/lib/pokedex.dart b/lib/pokedex.dart index f7df422..cc12183 100644 --- a/lib/pokedex.dart +++ b/lib/pokedex.dart @@ -40,16 +40,5 @@ class Pokedex with ResourceBase { versionGroups: json['version_groups'].map((e) => NamedAPIResource.fromJson(e)).toList(), ); } - - @override - Map toJson() => { - 'id': id, - 'name': name, - 'descriptions': descriptions.map((e) => e.toJson()).toList(), - 'names': names.map((e) => e.toJson()).toList(), - 'region': region.toJson(), - 'pokemon_entries': pokemonEntries.map((e) => e.toJson()).toList(), - 'version_groups': versionGroups.map((e) => e.toJson()).toList(), - }; } diff --git a/lib/pokedex_number.dart b/lib/pokedex_number.dart index 414c2f9..843601d 100644 --- a/lib/pokedex_number.dart +++ b/lib/pokedex_number.dart @@ -21,11 +21,5 @@ class PokedexNumber with ResourceBase { pokedex: NamedAPIResource.fromJson(json['pokedex']), ); } - - @override - Map toJson() => { - 'entry_number': entryNumber, - 'pokedex': pokedex.toJson(), - }; } diff --git a/lib/pokemon.dart b/lib/pokemon.dart index 4375a82..0078596 100644 --- a/lib/pokemon.dart +++ b/lib/pokemon.dart @@ -113,30 +113,6 @@ class Pokemon with ResourceBase { types: json['types'].map((e) => PokemonType.fromJson(e)).toList(), ); } - - @override - Map toJson() { - return { - 'name': name, - 'id': id, - 'height': height, - 'weight': weight, - 'is_default': isDefault, - 'order': order, - 'abilities': abilities, - 'base_experience': baseExperience, - 'forms': forms.map((e) => e.toJson()).toList(), - 'game_indices': gameIndices.map((e) => e.toJson()).toList(), - 'held_items': heldItems.map((e) => e.toJson()).toList(), - 'location_area_encounters': locationAreaEncounters.url, - 'moves': moves.map((e) => e.toJson()).toList(), - 'past_types': pastTypes.map((e) => e.toJson()).toList(), - 'sprites': sprites.toJson(), - 'species': species.toJson(), - 'stats': stats.map((e) => e.toJson()).toList(), - 'types': types.map((e) => e.toJson()).toList(), - }; - } } class PokemonResource extends NamedAPIResource { diff --git a/lib/pokemon_entry.dart b/lib/pokemon_entry.dart index 673ffd7..8b4c82c 100644 --- a/lib/pokemon_entry.dart +++ b/lib/pokemon_entry.dart @@ -21,11 +21,5 @@ class PokemonEntry with ResourceBase { pokemonSpecies: NamedAPIResource.fromJson(json['pokemon_species']), ); } - - @override - Map toJson() => { - 'entry_number': entryNumber, - 'pokemon_species': pokemonSpecies.toJson(), - }; } diff --git a/lib/pokemon_species.dart b/lib/pokemon_species.dart index f3ee1e0..cda4dcc 100644 --- a/lib/pokemon_species.dart +++ b/lib/pokemon_species.dart @@ -118,37 +118,6 @@ class PokemonSpecies with ResourceBase { ? List.from(json['varieties'].map((x) => PokemonSpeciesVariety.fromJson(x))) : [], ); - - @override - Map toJson() => { - 'base_happiness': baseHappiness, - 'capture_rate': captureRate, - 'color': color?.toJson(), - 'egg_groups': eggGroups.map((x) => x.toJson()).toList(), - 'evolution_chain': evolutionChain?.toJson(), - 'evolves_from_species': evolvesFromSpecies?.toJson(), - 'flavor_text_entries': flavorTextEntries.map((x) => x.toJson()).toList(), - 'form_descriptions': formDescriptions.map((x) => x.toJson()).toList(), - 'form_switchtable': formsSwitchable, - 'gender_rate': genderRate, - 'genera': genera.map((x) => x.toJson()).toList(), - 'generation': generation.toJson(), - 'growth_rate': growthRate.toJson(), - 'habitat': habitat?.toJson(), - 'has_gender_differences': hasGenderDifferences, - 'hatch_counter': hatchCounter, - 'id': id, - 'is_baby': isBaby, - 'is_legendary': isLegendary, - 'is_mythical': isMythical, - 'name': name, - 'names': names.map((x) => x.toJson()).toList(), - 'order': order, - 'pal_park_encounters': palParkEncounters.map((x) => x.toJson()).toList(), - 'pokedex_numbers': pokedexNumbers.map((x) => x.toJson()).toList(), - 'shape': shape?.toJson(), - 'varieties': varieties.map((x) => x.toJson()).toList(), - }; } class PokemonSpeciesResource extends NamedAPIResource { diff --git a/lib/pokemon_species_variety.dart b/lib/pokemon_species_variety.dart index 47be871..6ccfaf8 100644 --- a/lib/pokemon_species_variety.dart +++ b/lib/pokemon_species_variety.dart @@ -21,11 +21,5 @@ class PokemonSpeciesVariety with ResourceBase { pokemon: PokemonResource.fromJson(json['pokemon']), ); } - - @override - Map toJson() => { - 'is_default': isDefault, - 'pokemon': pokemon.toJson(), - }; } diff --git a/lib/region.dart b/lib/region.dart index d97bc80..2a57e77 100644 --- a/lib/region.dart +++ b/lib/region.dart @@ -38,19 +38,6 @@ class Region with ResourceBase { versionGroups: json['version_groups'].map((e) => NamedAPIResource.fromJson(e)).toList(), ); } - - @override - Map toJson() { - return { - 'id': id, - 'name': name, - 'locations': locations.map((e) => e.toJson()).toList(), - 'names': names.map((e) => e.toJson()).toList(), - 'main_generation': mainGeneration.toJson(), - 'pokedexes': pokedexes.map((e) => e.toJson()).toList(), - 'version_groups': versionGroups.map((e) => e.toJson()).toList(), - }; - } } class RegionResource extends NamedAPIResource { diff --git a/lib/sprites.dart b/lib/sprites.dart index 59f2ee9..620386e 100644 --- a/lib/sprites.dart +++ b/lib/sprites.dart @@ -238,12 +238,6 @@ class PokemonSpritesGeneration1 with ResourceBase { redBlue: json['red-blue'] != null ? PokemonSprites.fromJson(json['red-blue']) : null, yellow: json['yellow'] != null ? PokemonSprites.fromJson(json['yellow']) : null, ); - - @override - Map toJson() => { - 'red-blue': redBlue?.toJson(), - 'yellow': yellow?.toJson(), - }; } class PokemonSpritesGeneration2 with ResourceBase { @@ -267,13 +261,6 @@ class PokemonSpritesGeneration2 with ResourceBase { gold: json['gold'] != null ? PokemonSprites.fromJson(json['gold']) : null, silver: json['silver'] != null ? PokemonSprites.fromJson(json['silver']) : null, ); - - @override - Map toJson() => { - 'crystal': crystal?.toJson(), - 'gold': gold?.toJson(), - 'silver': silver?.toJson(), - }; } class PokemonSpritesGeneration3 with ResourceBase { @@ -297,13 +284,6 @@ class PokemonSpritesGeneration3 with ResourceBase { fireredLeafgreen: json['firered-leafgreen'] != null ? PokemonSprites.fromJson(json['firered-leafgreen']) : null, rubySapphire: json['ruby-sapphire'] != null ? PokemonSprites.fromJson(json['ruby-sapphire']) : null, ); - - @override - Map toJson() => { - 'emerald': emerald?.toJson(), - 'firered-leafgreen': fireredLeafgreen?.toJson(), - 'ruby-sapphire': rubySapphire?.toJson(), - }; } class PokemonSpritesGeneration4 with ResourceBase { @@ -328,13 +308,6 @@ class PokemonSpritesGeneration4 with ResourceBase { json['heartgold-soulsilver'] != null ? PokemonSprites.fromJson(json['heartgold-soulsilver']) : null, platinum: json['platinum'] != null ? PokemonSprites.fromJson(json['platinum']) : null, ); - - @override - Map toJson() => { - 'diamond-pearl': diamondPearl?.toJson(), - 'heartgold-soulsilver': heartgoldSoulsilver?.toJson(), - 'platinum': platinum?.toJson(), - }; } class PokemonSpritesGeneration5 with ResourceBase { @@ -352,11 +325,6 @@ class PokemonSpritesGeneration5 with ResourceBase { rawData: json, blackWhite: json['black-white'] != null ? PokemonSprites.fromJson(json['black-white']) : null, ); - - @override - Map toJson() => { - 'black-white': blackWhite?.toJson(), - }; } class PokemonSpritesGeneration6 with ResourceBase { @@ -378,12 +346,6 @@ class PokemonSpritesGeneration6 with ResourceBase { json['omegaruby-alphasapphire'] != null ? PokemonSprites.fromJson(json['omegaruby-alphasapphire']) : null, xy: json['x-y'] != null ? PokemonSprites.fromJson(json['x-y']) : null, ); - - @override - Map toJson() => { - 'omegaruby-alphasapphire': omegarubyAlphasapphire?.toJson(), - 'x-y': xy?.toJson(), - }; } class PokemonSpritesGeneration7 with ResourceBase { @@ -405,12 +367,6 @@ class PokemonSpritesGeneration7 with ResourceBase { ultraSunUltraMoon: json['ultra-sun-ultra-moon'] != null ? PokemonSprites.fromJson(json['ultra-sun-ultra-moon']) : null, ); - - @override - Map toJson() => { - 'icons': icons?.toJson(), - 'ultra-sun-ultra-moon': ultraSunUltraMoon?.toJson(), - }; } class PokemonSpritesGeneration8 with ResourceBase { @@ -428,189 +384,5 @@ class PokemonSpritesGeneration8 with ResourceBase { rawData: json, icons: json['icons'] != null ? PokemonSprites.fromJson(json['icons']) : null, ); - - @override - Map toJson() => { - 'icons': icons?.toJson(), - }; } -/* -"sprites": { - "back_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/1.png", - "back_female": null, - "back_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/1.png", - "back_shiny_female": null, - "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/1.png", - "front_female": null, - "front_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/shiny/1.png", - "front_shiny_female": null, - "other": { - "dream_world": { - "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/dream-world/1.svg", - "front_female": null - }, - "home": { - "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/home/1.png", - "front_female": null, - "front_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/home/shiny/1.png", - "front_shiny_female": null - }, - "official-artwork": { - "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/1.png", - "front_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/shiny/1.png" - } - }, - "versions": { - "generation-i": { - "red-blue": { - "back_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-i/red-blue/back/1.png", - "back_gray": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-i/red-blue/back/gray/1.png", - "back_transparent": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-i/red-blue/transparent/back/1.png", - "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-i/red-blue/1.png", - "front_gray": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-i/red-blue/gray/1.png", - "front_transparent": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-i/red-blue/transparent/1.png" - }, - "yellow": { - "back_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-i/yellow/back/1.png", - "back_gray": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-i/yellow/back/gray/1.png", - "back_transparent": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-i/yellow/transparent/back/1.png", - "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-i/yellow/1.png", - "front_gray": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-i/yellow/gray/1.png", - "front_transparent": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-i/yellow/transparent/1.png" - } - }, - "generation-ii": { - "crystal": { - "back_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-ii/crystal/back/1.png", - "back_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-ii/crystal/back/shiny/1.png", - "back_shiny_transparent": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-ii/crystal/transparent/back/shiny/1.png", - "back_transparent": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-ii/crystal/transparent/back/1.png", - "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-ii/crystal/1.png", - "front_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-ii/crystal/shiny/1.png", - "front_shiny_transparent": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-ii/crystal/transparent/shiny/1.png", - "front_transparent": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-ii/crystal/transparent/1.png" - }, - "gold": { - "back_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-ii/gold/back/1.png", - "back_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-ii/gold/back/shiny/1.png", - "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-ii/gold/1.png", - "front_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-ii/gold/shiny/1.png", - "front_transparent": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-ii/gold/transparent/1.png" - }, - "silver": { - "back_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-ii/silver/back/1.png", - "back_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-ii/silver/back/shiny/1.png", - "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-ii/silver/1.png", - "front_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-ii/silver/shiny/1.png", - "front_transparent": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-ii/silver/transparent/1.png" - } - }, - "generation-iii": { - "emerald": { - "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-iii/emerald/1.png", - "front_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-iii/emerald/shiny/1.png" - }, - "firered-leafgreen": { - "back_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-iii/firered-leafgreen/back/1.png", - "back_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-iii/firered-leafgreen/back/shiny/1.png", - "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-iii/firered-leafgreen/1.png", - "front_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-iii/firered-leafgreen/shiny/1.png" - }, - "ruby-sapphire": { - "back_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-iii/ruby-sapphire/back/1.png", - "back_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-iii/ruby-sapphire/back/shiny/1.png", - "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-iii/ruby-sapphire/1.png", - "front_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-iii/ruby-sapphire/shiny/1.png" - } - }, - "generation-iv": { - "diamond-pearl": { - "back_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-iv/diamond-pearl/back/1.png", - "back_female": null, - "back_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-iv/diamond-pearl/back/shiny/1.png", - "back_shiny_female": null, - "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-iv/diamond-pearl/1.png", - "front_female": null, - "front_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-iv/diamond-pearl/shiny/1.png", - "front_shiny_female": null - }, - "heartgold-soulsilver": { - "back_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-iv/heartgold-soulsilver/back/1.png", - "back_female": null, - "back_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-iv/heartgold-soulsilver/back/shiny/1.png", - "back_shiny_female": null, - "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-iv/heartgold-soulsilver/1.png", - "front_female": null, - "front_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-iv/heartgold-soulsilver/shiny/1.png", - "front_shiny_female": null - }, - "platinum": { - "back_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-iv/platinum/back/1.png", - "back_female": null, - "back_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-iv/platinum/back/shiny/1.png", - "back_shiny_female": null, - "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-iv/platinum/1.png", - "front_female": null, - "front_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-iv/platinum/shiny/1.png", - "front_shiny_female": null - } - }, - "generation-v": { - "black-white": { - "animated": { - "back_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-v/black-white/animated/back/1.gif", - "back_female": null, - "back_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-v/black-white/animated/back/shiny/1.gif", - "back_shiny_female": null, - "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-v/black-white/animated/1.gif", - "front_female": null, - "front_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-v/black-white/animated/shiny/1.gif", - "front_shiny_female": null - }, - "back_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-v/black-white/back/1.png", - "back_female": null, - "back_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-v/black-white/back/shiny/1.png", - "back_shiny_female": null, - "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-v/black-white/1.png", - "front_female": null, - "front_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-v/black-white/shiny/1.png", - "front_shiny_female": null - } - }, - "generation-vi": { - "omegaruby-alphasapphire": { - "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/omegaruby-alphasapphire/1.png", - "front_female": null, - "front_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/omegaruby-alphasapphire/shiny/1.png", - "front_shiny_female": null - }, - "x-y": { - "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/1.png", - "front_female": null, - "front_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vi/x-y/shiny/1.png", - "front_shiny_female": null - } - }, - "generation-vii": { - "icons": { - "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vii/icons/1.png", - "front_female": null - }, - "ultra-sun-ultra-moon": { - "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vii/ultra-sun-ultra-moon/1.png", - "front_female": null, - "front_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vii/ultra-sun-ultra-moon/shiny/1.png", - "front_shiny_female": null - } - }, - "generation-viii": { - "icons": { - "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-viii/icons/1.png", - "front_female": null - } - } - } -}, -*/ - diff --git a/lib/stat.dart b/lib/stat.dart index ba25895..4564ea7 100644 --- a/lib/stat.dart +++ b/lib/stat.dart @@ -29,15 +29,6 @@ class PokemonStat with ResourceBase { stat: NamedAPIResource.fromJson(json['stat']), ); } - - @override - Map toJson() { - return { - 'base_stat': baseStat, - 'effort': effort, - 'stat': stat.toJson(), - }; - } } class Stat with ResourceBase { @@ -81,20 +72,5 @@ class Stat with ResourceBase { characteristics: json['characteristics'].map((e) => Characteristic.fromJson(e)).toList(), ); } - - @override - Map toJson() { - return { - 'id': id, - 'name': name, - 'game_index': gameIndex, - 'is_battle_only': isBattleOnly, - 'move_damage_class': moveDamageClass.toJson(), - 'names': names.map((e) => e.toJson()).toList(), - 'affecting_moves': affectingMoves.toJson(), - 'affecting_natures': affectingNatures.toJson(), - 'characteristics': characteristics.map((e) => e.toJson()).toList(), - }; - } } diff --git a/lib/type.dart b/lib/type.dart index 8b73662..bd973a8 100644 --- a/lib/type.dart +++ b/lib/type.dart @@ -20,14 +20,6 @@ class PokemonType with ResourceBase { type: TypeResource.fromJson(json['type']), ); } - - @override - Map toJson() { - return { - 'slot': slot, - 'type': type.toJson(), - }; - } } class Type with ResourceBase { @@ -75,22 +67,6 @@ class Type with ResourceBase { pokemon: (json['pokemon'] as List).map((e) => TypePokemon.fromJson(e)).toList(), ); } - - @override - Map toJson() { - return { - 'id': id, - 'name': name, - 'damage_relations': damageRelations.toJson(), - 'past_damage_relations': pastDamageRelations.map((e) => e.toJson()).toList(), - 'game_indices': gameIndices.map((e) => e.toJson()).toList(), - 'generation': generation.toJson(), - 'names': names.map((e) => e.toJson()).toList(), - 'move_damage_class': moveDamageClass.toJson(), - 'moves': moves.map((e) => e.toJson()).toList(), - 'pokemon': pokemon.map((e) => e.toJson()).toList(), - }; - } } class TypeRelations with ResourceBase { @@ -125,18 +101,6 @@ class TypeRelations with ResourceBase { doubleDamageFrom: (json['double_damage_from'] as List).map((e) => NamedAPIResource.fromJson(e)).toList(), ); } - - @override - Map toJson() { - return { - 'no_damage_to': noDamageTo.map((e) => e.toJson()).toList(), - 'half_damage_to': halfDamageTo.map((e) => e.toJson()).toList(), - 'double_damage_to': doubleDamageTo.map((e) => e.toJson()).toList(), - 'no_damage_from': noDamageFrom.map((e) => e.toJson()).toList(), - 'half_damage_from': halfDamageFrom.map((e) => e.toJson()).toList(), - 'double_damage_from': doubleDamageFrom.map((e) => e.toJson()).toList(), - }; - } } class TypeRelationsPast with ResourceBase { @@ -159,14 +123,6 @@ class TypeRelationsPast with ResourceBase { damageRelations: TypeRelations.fromJson(json['damage_relations']), ); } - - @override - Map toJson() { - return { - 'generation': generation.toJson(), - 'damage_relations': damageRelations.toJson(), - }; - } } class TypePokemon with ResourceBase { @@ -189,14 +145,6 @@ class TypePokemon with ResourceBase { pokemon: PokemonResource.fromJson(json['pokemon']), ); } - - @override - Map toJson() { - return { - 'slot': slot, - 'pokemon': pokemon.toJson(), - }; - } } class TypeResource extends NamedAPIResource { @@ -210,14 +158,6 @@ class TypeResource extends NamedAPIResource { ); } - @override - Map toJson() { - return { - 'url': url, - 'name': name, - }; - } - @override Type mapper(data) { return Type.fromJson(data); diff --git a/lib/version_game_index.dart b/lib/version_game_index.dart index a41a6d8..cf7a92f 100644 --- a/lib/version_game_index.dart +++ b/lib/version_game_index.dart @@ -20,13 +20,5 @@ class VersionGameIndex with ResourceBase { version: NamedAPIResource.fromJson(json['version']), ); } - - @override - Map toJson() { - return { - 'game_index': gameIndex, - 'version': version.toJson(), - }; - } } diff --git a/lib/version_group.dart b/lib/version_group.dart index b5ebafb..ddebe7b 100644 --- a/lib/version_group.dart +++ b/lib/version_group.dart @@ -41,20 +41,6 @@ class VersionGroup with ResourceBase { rawData: json, ); } - - @override - Map toJson() { - return { - 'id': id, - 'name': name, - 'order': order, - 'generation': generation.toJson(), - 'move_learn_methods': moveLearnMethods.map((e) => e.toJson()).toList(), - 'pokedexes': pokedexes.map((e) => e.toJson()).toList(), - 'regions': regions.map((e) => e.toJson()).toList(), - 'versions': versions.map((e) => e.toJson()).toList(), - }; - } } class VersionGroupResource extends NamedAPIResource {