responseCacheData<T> method
Implementation
Future<T?> responseCacheData<T>({required String key}) async {
T? dataCache;
final cacheBox = await Hive.openBox(key);
try {
if (cacheBox.isNotEmpty == true) {
if (cacheBox.values.single != null) {
dataCache = cacheBox.get(key);
return Future.value(dataCache);
}
}
} catch (e) {
cacheBox.clear();
return Future.value(dataCache);
}
return Future.value(dataCache);
}