write method

Future<void> write(
  1. String key,
  2. dynamic value
)

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 data
  • value - The data to store (can be any type)

Returns

A Future&lt;void&gt; 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);