read<T> method

T? read<T>(
  1. String key
)

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&lt;String&gt;('user_token');
final preferences = CacheStorageHandler.instance.read&lt;Map&lt;String, dynamic&gt;&gt;('user_preferences');

Implementation

T? read<T>(String key) => _getStorage.read<T>(key);