cacheFile static method
Cache a file to temporary storage
Implementation
static Future<String> cacheFile(String key, File file) async {
_ensureInitialized();
final cacheDir = _cacheDir!;
final cachedFile = File('${cacheDir.path}/$key');
if (await file.exists()) {
await file.copy(cachedFile.path);
return cachedFile.path;
}
throw Exception('Source file does not exist');
}