imsamgarg / firebase_cached_image

Cache Manager and Cached ImageProvider for Firebase Cloud Storage Objects.
MIT License
10 stars 17 forks source link

onError handling #10

Open greenc0102 opened 1 year ago

greenc0102 commented 1 year ago

Just implemented this to my project and getting great results so far. As a test I changed my url to be wrong and this causes an error of course. Is there a way to handle such an error with this package? If not what would be the best way to do so manually?

Thanks in advance

JonahBateman commented 1 year ago

I would also like to know a way to handle exceptions thrown from inside FirebaseImageProvider. In my application I have to check for invalid urls so I have to hit the server and make sure the url is valid before I use this package because if an image doesn't exist on the server then the exception is caught by the Image Resource Service before I can handle it.

It would be nice to try and access the cache before I need to make any network requests.

imsamgarg commented 1 year ago

I'm planning to add the optional FirebaseUrl? fallbackUrl field to the FirebaseImageProvider. It will first try to fetch the firebaseUrl if the image does not exist on the server, then it will try to fetch the fallbackUrl. Any feedback would be much appreciated.