What GetStorage is and when to use it
masterConcept
GetStorage is a fast, ultra-lightweight, synchronous key-value storage that combines in-memory access with disk backup. It is designed for high-speed read/write operations where data is immediately available in memory after a write call.
Use Cases
- Storing simple Maps.
- Caching HTTP requests.
- Storing simple user information.
- Simple persistent state storage.
- Replacing
SharedPreferences.
Limitations
- Not a database: It does not support indexing or complex querying. For those needs, use Hive or Sqflite.
- Background Disk Writes: While memory updates are instant, disk backups happen in the background. If you must ensure a write is finished on disk before proceeding, use
await box.write(). If you find yourself needing toawaitevery operation, a database might be a better fit.