pokedex 0.3.0 copy "pokedex: ^0.3.0" to clipboard
pokedex: ^0.3.0 copied to clipboard

A Dart wrapper for PokeAPI that provides everything Pokémon-related.

example/example.dart

import 'package:pokedex/pokedex.dart';

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

  // with Future
  pokedex.pokemonSpecies.get(name: "aegislash").then((aegislashSpecies) {
    print(aegislashSpecies);
  });

  // with async function
  final aegislashBlade = await pokedex.pokemon.get(name: "aegislash-blade");
  print(aegislashBlade);

  // get pokemon by id
  final aegislashShield = await pokedex.pokemon.get(id: 681);
  print(aegislashShield);

  // get list of resources for pokemon
  final pokemonSpeciesResources =
      (await pokedex.pokemonSpecies.getPage(limit: 100)).results;
  for (final resource in pokemonSpeciesResources) {
    final species = await pokedex.pokemonSpecies.getByUrl(resource.url);
    print(species);
  }

  // get all berries
  final berryResources = (await pokedex.berries.getAll()).results;
  for (final resource in berryResources) {
    final berry = await pokedex.berries.getByUrl(resource.url);
    print(berry);
  }

  // get by url
  final item =
      await pokedex.items.getByUrl('https://pokeapi.co/api/v2/item/100');
  print(item);
}
12
likes
110
pub points
45%
popularity

Publisher

unverified uploader

A Dart wrapper for PokeAPI that provides everything Pokémon-related.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

freezed_annotation, http, json_annotation

More

Packages that depend on pokedex