saveToAppCache function

Future<File> saveToAppCache(
  1. File imageFile
)

Saves imageFile to the app's temporary directory.

This file is not persistent and may be deleted by the OS.

Implementation

Future<File> saveToAppCache(File imageFile) async {
  final dir = await getTemporaryDirectory();
  final fileName = 'itinereo_temp${DateTime.now().millisecondsSinceEpoch}.jpg';
  final savedPath = File('${dir.path}/$fileName');
  await imageFile.copy(savedPath.path);
  return savedPath;
}