flutter_cached_network_image
flutter_cached_network_image copied to clipboard
[FR] Use hive + file system instead of sqflite as the storage layer.
The sqflite plugin has many downsides, platform dependent, not available on all platform to name a few.
Hive key-value stored built with pure dart. So it's available on all platforms supported by Flutter. It's also very light weight and fast, perfect for the image caching case.
Hive is a memory storage. Because of this fetching one image will put all 'box' (all images in box) in memory. You can store one image in one box, but it will be just simple file-per-image storage. Has no reason to use Hive in this way. I think better solution will be caching in files. I don't know why SQLite used for files now.. Its just overhead.
@NaikSoftware, Actually, Hive load the boxes in memory but persist them on the disk. One box, can contain several images. This could help achieve severals requested feature like multiple size by images, use a smaller image as placeholder...
But to save them into a box they would have to be Uint8List... So probably only the path to the image would be saved.
@bounty1342 Hive read boxes in main (UI) isolate. It cause lags and frame drops when you try to read box larger than 1-2Kb (depending on device you use). Move Hive to another isolate will have overhead. Much better solution is using any object database.