write method
Writes data to the cache storage.
This method stores the provided value with the specified key for later retrieval. The data persists across app sessions.
Parameters:
key
- The unique identifier for the stored datavalue
- The data to store (can be any type)
Returns
A Future<void>
that completes when the write operation finishes.
Example
await CacheStorageHandler.instance.write('user_token', 'abc123');
await CacheStorageHandler.instance.write('user_preferences', {'theme': 'dark'});
Implementation
Future<void> write(String key, dynamic value) async =>
await _getStorage.write(key, value);