has method
check if cache entry for key exist.
Implementation
Future<bool> has(String key) async {
if (!_initialized) {
await init();
}
if (remainingDurationForKey(key).isNegative) {
return false;
}
if (kIsWeb) {
final txn = _db?.transaction(_basePath, idbModeReadOnly);
final store = txn?.objectStore(_basePath);
final value = await store?.getObject(key);
await txn?.completed;
return value != null;
} else {
return await FileSystemEntity.type(await _pathForKey(key)) !=
FileSystemEntityType.notFound;
}
}