Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adding the ability to access the timestamp when an image was cached would enable the ability to implement custom cache invalidation techniques. For this, I request to add a method to get the timestamp when an image was cached, if it was cached.
My proposal is to simply add a static method:
static Future<DateTime?> getCachedDate({required String imageUrl})
, which returns the cached date, or null if no cached image is available. Looking at the package's source code, this should be fairly simple as the package already stores timestamps for cached files.An example of a use case of this would be in an app where a widget displays an image from a Firebase Storage file, where the file could be updated externally at any time. Firebase storage does not currently have a way to notify the client when a file is updated, so a way to solve this would be to store an updatedAt timestamp in the file's metadata, so we just need to fetch the metadata of the file to access its timestamp. With the getCachedDate method, we can then compare our cached image's timestamp with the updatedAt timestamp of the file in the cloud, and invalidate our local cached image if it is outdated.