savToCache method
stores data in the cache for the given key
Implementation
Future<bool> savToCache(String path, String data) async {
Directory tempDir = await getTemporaryDirectory();
try {
path = path.split('/').last;
if (kDebugMode) print('save to cache.....$path. $data');
await File('${tempDir.path}/$path.json').writeAsString(data);
return true;
} catch (e) {
if (kDebugMode) print(e);
return false;
}
}