Thesmader / pokedex

Pokedex mobile application using riverpod

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pokedex

Pokedex flutter application built using PokeAPI

Running the application

  • 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 the index argument
  • the /pokemon endpoint just gives a list of objects with pokemon name and the url for fetching details. To show the UI I need images as well which will fetched from the url in each object.
  • To tackle the above problem resolvedPokemonProvider uses pokemonProvider under the hood and maps the result from pokemonProvider to a list of pokemonDetailsProvider
  • pokemonDetailsProvider is a FutureProvider responsible for fetching the details of a pokemon, given the url 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

References

About

Pokedex mobile application using riverpod


Languages

Language:Dart 36.1%Language:C++ 27.3%Language:CMake 24.4%Language:Ruby 3.5%Language:HTML 3.3%Language:Swift 2.0%Language:C 1.9%Language:CSS 1.1%Language:JavaScript 0.2%Language:Kotlin 0.2%Language:Objective-C 0.0%