hungps/flutter_pokedex

Images not fetching for web support.

moulibheemaneti opened this issue · 8 comments

Hey @hungps,
I'm starting the web support for the app too. While doing so, we are not able to fetch images.

Screenshot 2022-11-01 at 12 22 07 PM

And the error in terminal is:
Screenshot 2022-11-01 at 12 22 47 PM

But the image url in terminal is getting redirected.

Hi @moulibheemaneti,
Thank you for contributing. The host (pokemon.com) might prevent another website from using their images. I'm planning on cloning the image and hosting it in Github to solve this.

I guess that would solve the problem. But I guess there will some limit for storing right?

@moulibheemaneti Actually PokéAPI has done this (even much more images than we need to use in our app). We might simply clone their repo and remove unnecessary things. You can see the sprites that we need to clone here

You can try something like this to get the image URL: https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/{pokemon-number}.png

For example: https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/1.png

@hungps woah. That's great. Let's do what you suggested.

@hungps Can I contact you through LinkedIn?

@moulibheemaneti I will prepare another repository for storing the images (maybe this weekend) and give you the link when I'm finished. If you are currently working on it, you can use the PokeAPI URL temporarily for now.

@moulibheemaneti

Can I contact you through LinkedIn?

Sure, just send me a request

@moulibheemaneti I've forked the PokéAPI's sprites repository. You can now load the pokemon image by using this format:
https://raw.githubusercontent.com/hungps/flutter_pokedex_db/master/sprites/pokemon/other/official-artwork/{pokemon-number}.png