pokedex

Creator: coderz1093

Last updated:

0 purchases

pokedex Image
pokedex Images
Add to Cart

Description:

pokedex

pokedex #



A Dart wrapper for PokeAPI.
pokedex is heavily inspired by chulwoo-park's pokeapi_dart.
Table of Contents



Installation
Usage

Simple requests


Endpoints

Berries
Contests
Encounters
Evolution
Games
Items
Locations
Machines
Moves
Pokemon
Utility
Root Endpoints




Installation #
Add this to your package's pubspec.yaml file:
dependencies:
pokedex: ^0.3.0
copied to clipboard
Then run dart pub get or flutter pub get if you are using Flutter.
Now in your Dart code, you can use:
import 'package:pokedex/pokedex.dart';
copied to clipboard
Check out the documentation for this package and PokeAPI for more information.
Usage #
import 'package:pokedex/pokedex.dart';
final dex = Pokedex();
copied to clipboard
Simple requests #

❕ Some pokemon has multiple forms: If you want to get the data for a specific pokemon species, it is recommended to use pokemonSpecies endpoint instead of pokemon endpoints, as shown below.


See also issue #635

import 'package:pokeapi_dart/pokeapi_dart.dart';

Future<void> main() async {
final pokedex = Pokedex();

// get Aegislash species information with async function
final aegislashSpecies = pokedex.pokemonSpecies.get(name: 'aegislash');
print(aegislashSpecies);

// get pokemon by name
final aegislashBlade = await pokedex.pokemon.get(name: 'aegislash-blade');
final aegislashShield = await pokedex.pokemon.get(id: 'aegislash-shield');

// get pokemon by id
aegislashBlade = await pokedex.pokemon.get(id: 10026);
aegislashShield = await pokedex.pokemon.get(id: 681);
}
copied to clipboard
Endpoints #
The get method can use id or name as a parameter according to each endpoint type.
Refer to the pokeapi v2 docs to find out more about how the data is structured.
Berries #
Use berries to return data about a specific berry.
Pokedex().berries.get(name: 'cheri').then((response) {
print(response);
});
copied to clipboard
Use berryFirmnesses to return data about the firmness of a specific berry.
Pokedex().berryFirmnesses.get(name: 'very-soft').then((response) {
print(response);
});
copied to clipboard
Use berryFlavors to return data about the flavor of a specific berry.
Pokedex().berryFlavors.get(name: 'spicy').then((response) {
print(response);
})
copied to clipboard
Contests #
Use contestTypes to return data about the effects of moves when used in contests.
Pokedex().contestTypes.get(name: 'cool').then((response) {
print(response);
})
copied to clipboard
Use contestEffects to return data about the effects of moves when used in contests.
Pokedex().contestEffects.get(id: 1).then((response) {
print(response);
})
copied to clipboard
Use superContestEffects to return data about the effects of moves when used in super contests.
Pokedex().superContestEffects.get(id: 1).then((response) {
print(response);
})
copied to clipboard
Encounters #
Use encounterMethods to return data about the conditions in which a trainer may encounter a pokemon in the wild.
Pokedex().encounterMethods.get(name: 'walk').then((response) {
print(response);
})
copied to clipboard
Use encounterConditions to return data that affects which pokemon might appear in the wild.
Pokedex().encounterConditions.get(name: 'swarm').then((response) {
print(response);
})
copied to clipboard
Use encounterConditionValues to return data the various states that an encounter condition can have.
Pokedex().encounterConditionValues.get(name: 'swarm-yes').then((response) {
print(response);
})
copied to clipboard
Evolution #
Use evolutionChains to return data evolution chains.
Pokedex().evolutionChains.get(id: 1).then((response) {
print(response);
})
copied to clipboard
Use evolutionTriggers to return data about triggers which cause pokemon to evolve.
Pokedex().evolutionTriggers.get(name: 'level-up').then((response) {
print(response);
})
copied to clipboard
Games #
Use generations to return data about the different generations of pokemon games.
Pokedex().generations.get(name: 'generation-i').then((response) {
print(response);
})
copied to clipboard
Use pokedexes to return data about specific types of pokedexes.
Pokedex().pokedexes.get(name: 'kanto').then((response) {
print(response);
})
copied to clipboard
Use versions to return data about specific versions of pokemon games.
Pokedex().versions.get(name: 'red').then((response) {
print(response);
})
copied to clipboard
Use versionGroups to return data about specific version groups of pokemon games.
Pokedex().versionGroups.get(name: 'red-blue').then((response) {
print(response);
})
copied to clipboard
Items #
Use items to return data about specific items.
Pokedex().items.get(name: 'master-ball').then((response) {
print(response);
})
copied to clipboard
Use itemAttributes to return data about specific item attribute.
Pokedex().itemAttributes.get(name: 'countable').then((response) {
print(response);
})
copied to clipboard
Use itemCategories to return data about specific item category.
Pokedex().itemCategories.get(name: 'stat-boosts').then((response) {
print(response);
})
copied to clipboard
Use itemFlingEffects to return data about specific item fling effect.
Pokedex().itemFlingEffects.get(name: 'badly-poison').then((response) {
print(response);
})
copied to clipboard
Use itemPockets to return data about specific pockets in a players bag.
Pokedex().itemPockets.get(name: 'misc').then((response) {
print(response);
})
copied to clipboard
Locations #
Use locations to return data about specific pokemon location.
Pokedex().locations.get(name: 'sinnoh').then((response) {
print(response);
})
copied to clipboard
Use locationAreas to return data about specific pokemon location area.
Pokedex().locationAreas.get(name: 'canalave-city-area').then((response) {
print(response);
})
copied to clipboard
Use palParkAreas to return data about specific pokemon pal park area.
Pokedex().palParkAreas.get(name: 'forest').then((response) {
print(response);
})
copied to clipboard
Use regions to return data about specific pokemon region.
Pokedex().regions.get(name: 'kanto').then((response) {
print(response);
})
copied to clipboard
Machines #
Use machines to return data about specific machine.
Pokedex().machines.get(id: 2).then((response) {
print(response);
})
copied to clipboard
Moves #
Use moves to return data about specific pokemon move.
Pokedex().moves.get(name: 'pound').then((response) {
print(response);
})
copied to clipboard
Use moveAilments to return data about specific pokemon move ailment.
Pokedex().moveAilments.get(name: 'paralysis').then((response) {
print(response);
})
copied to clipboard
Use moveBattleStyles to return data about specific pokemon move battle style.
Pokedex().moveBattleStyles.get(name: 'attack').then((response) {
print(response);
})
copied to clipboard
Use moveCategories to return data about specific pokemon move category.
Pokedex().moveCategories.get(name: 'ailment').then((response) {
print(response);
})
copied to clipboard
Use moveDamageClasses to return data about specific pokemon damage class.
Pokedex().moveDamageClasses.get(name: 'status').then((response) {
print(response);
})
copied to clipboard
Use moveLearnMethods to return data about specific pokemon learn method.
Pokedex().moveLearnMethods.get(name: 'level-up').then((response) {
print(response);
})
copied to clipboard
Use moveTargets to return data about specific pokemon move target.
Pokedex().moveTargets.get(name: 'specific-move').then((response) {
print(response);
})
copied to clipboard
Pokemon #
Use abilities to return data about specific pokemon ability.
Pokedex().abilities.get(name: 'stench').then((response) {
print(response);
})
copied to clipboard
Use characteristics to return data about specific pokemon characteristic.
Pokedex().characteristics.get(id: 1).then((response) {
print(response);
})
copied to clipboard
Use eggGroups to return data about specific pokemon egg group.
Pokedex().eggGroups.get(name: 'monster').then((response) {
print(response);
})
copied to clipboard
Use genders to return data about specific pokemon gender.
Pokedex().genders.get(name: 'female').then((response) {
print(response);
})
copied to clipboard
Use growthRates to return data about specific pokemon growth rate.
Pokedex().growthRates(name: 'slow').then((response) {
print(response);
})
copied to clipboard
Use natures to return data about specific pokemon nature.
Pokedex().natures.get(name: 'bold').then((response) {
print(response);
})
copied to clipboard
Use pokeathlonStats to return data about specific pokeathon stat.
Pokedex().pokeathlonStats.get(name: 'speed').then((response) {
print(response);
})
copied to clipboard
Use pokemon to return data about specific pokemon.
Pokedex().pokemon.get(name: 'clefairy').then((response) {
print(response);
})
copied to clipboard
Use pokemonColors to return data about specific pokemon color.
Pokedex().pokemonColors.get(name: 'black').then((response) {
print(response);
})
copied to clipboard
Use pokemonForms to return data about specific pokemon form.
Pokedex().pokemonForms.get(name: 'arceus-bug').then((response) {
print(response);
})
copied to clipboard
Use pokemonHabitats to return data about specific pokemon habitat.
Pokedex().pokemonHabitats.get(name: 'cave').then((response) {
print(response);
})
copied to clipboard
Use pokemonShapes to return data about specific pokemon shape.
Pokedex().pokemonShapes.get(name: 'ball').then((response) {
print(response);
})
copied to clipboard
Use pokemonSpecies to return data about specific pokemon species.
Pokedex().pokemonSpecies.get(name: 'wormadam').then((response) {
print(response);
})
copied to clipboard
Use stats to return data about specific pokemon stat.
Pokedex().stats.get(name: 'attack').then((response) {
print(response);
})
copied to clipboard
Use types to return data about specific pokemon type.
Pokedex().types.get(name: 'ground').then((response) {
print(response);
})
copied to clipboard
Utility #
Use languages to return data about specific pokemon language.
Pokedex().languages.get(name: 'ja').then((response) {
print(response);
})
copied to clipboard
Root Endpoints #
Each endpoint provides a getPage method to get paged items contained by that endpoint.
It can configure offset and limit.

offset is where to start. The first item that you will get. Default 0
limit is how many items you want to list. Default 20

This call will get the list of Pokémon between ID 35 and ID 44
Pokedex().pokemon.getPage(offset: 34, limit 10).then((response) {
print(response);
})
copied to clipboard
This is what you will get:

Or you can get all items with getAll.
This call will get all items within the pokemon endpoint.
Pokedex().pokemon.getAll().then((response) {
print(response);
})
copied to clipboard
This is what you will get:

Each endpoint also provides a getByUrl method to fetch a specific item with a provided url.
This call will get the Pokémon with id 274.
Pokedex().pokemon.getByUrl('https://pokeapi.co/api/v2/pokemon/274/').then((response) {
print(response);
})
copied to clipboard
This is what you will get:

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.