Replies: 3 comments
-
|
You can’t directly iterate over ImageCache because it doesn’t expose its internal collection. If you need to loop through every entry, you’ll have to maintain your own list/dictionary of cached items when adding them. Then you can iterate over your own structure instead of the cache itself. |
Beta Was this translation helpful? Give feedback.
-
|
If you're using ImageCache (from Flutter’s cached_network_image package), it doesn’t expose a direct public API to iterate over all cached entries. The usual approach is to access the underlying file cache directory and iterate through the files manually. For example, you can use DefaultCacheManager().getFilePath() or check the cache directory via getFilePath() and then list all files using Directory(path).list(). If you need full programmatic access to the cache entries, you may have to implement your own cache manager or extend BaseCacheManager to expose that functionality. |
Beta Was this translation helpful? Give feedback.
-
|
You can’t directly iterate over ImageCache since it doesn’t expose its internal storage. To loop through entries, maintain your own list or dictionary when adding items, or access the underlying file cache directory and list the files manually using DefaultCacheManager() and Directory(path).list(). For full programmatic access, consider extending BaseCacheManager. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
How can I iterate over all entries in ImageCache?
Beta Was this translation helpful? Give feedback.
All reactions