Pokedex flutter application built using PokeAPI
- Clone this repository
- Run
flutter pub get
- Run
flutter pub run build_runner build
- Run the app using your IDE of
flutter run
Explanation of pokemonDetailsProvider logic (To see the providers go to lib/pokemon/providers/providers.dart)
pokemonProvider
fetches a page of pokemon from API based on theindex
argument- the
/pokemon
endpoint just gives a list of objects with pokemon name and theurl
for fetching details. To show the UI I need images as well which will fetched from theurl
in each object. - To tackle the above problem
resolvedPokemonProvider
usespokemonProvider
under the hood and maps the result frompokemonProvider
to a list ofpokemonDetailsProvider
pokemonDetailsProvider
is aFutureProvider
responsible for fetching the details of a pokemon, given theurl
as an argument- In the grid UI each item listens to their corresponding
pokemonDetailsProvider
to render the UI according to the value of the provider
-
Code snippets
- Pagination logic inspired from Roaa94's movies_app