read<T> method
Reads data from the cache storage.
This method retrieves previously stored data using the specified key. The data is returned with the specified generic type.
Parameters:
key
- The unique identifier for the stored data
Returns
The stored data cast to type T
, or null
if not found
Example
final token = CacheStorageHandler.instance.read<String>('user_token');
final preferences = CacheStorageHandler.instance.read<Map<String, dynamic>>('user_preferences');
Implementation
T? read<T>(String key) => _getStorage.read<T>(key);