getCachedData method

Future<String?> getCachedData(
  1. String key
)

returns data stored in the cache for the given key

Implementation

Future<String?> getCachedData(String key) async {
  try {
    final file = await _fileFor(key);
    if (!await file.exists()) return null;
    return await file.readAsString();
  } catch (e) {
    ApiConfig().log('cache read failed for $key: $e');
    return null;
  }
}