Baseflow / flutter_cached_network_image

Download, cache and show images in a flutter app
https://baseflow.com
2.45k stars 657 forks source link

Add Image provider which takes an id, and an async function to fetch url from that id #983

Open akshdeep-singh opened 3 weeks ago

akshdeep-singh commented 3 weeks ago

🚀 Feature Requests

Add Image provider which takes an id, and an async function to fetch url from that id as input.

Contextualize the feature

Images stored in cloud storages (Firebase Storage, AWS S3, etc.) have async functions to get url for files stored. I need a way to check cache before getting the url, via an id (path of image on cloud storage), such that if cache has an entry for the specified id, it will load image from cache, otherwise it will fetch url for that id, and then the same steps as it does.

Describe the feature

CachedStorageImageProvider(
  String id,
  Future<String> Function(String id) fetchUrl,
) 

The fetch url function should be called after checking cache and image not present in cache.

Platforms affected (mark all that apply)