I was looking for ways to read and write image files in Flutter Web into local directory. The purpose is so the site won't need to download the images twice. For example: we can check if the file exist and if it doesn't then we can download it.
We can do this easily in Flutter App like this:
To access the file in local storage:
// Getting App's local directory final Directory localRootDirectory = await getApplicationDocumentsDirectory(); final String filePath = p.join(localRootDirectory.path, path, filename); final tempFile = File(filePath); return await tempFile.readAsBytes();
Then to save the new file we do:
//Writing the image into file tempFile = await File(filePath).create(recursive: true); await tempFile.writeAsBytes(bytes);
So is there any equivalent of the above solutions in Flutter Web?
Thank you