I'm building a mobile app with flutter using firebase-storage as package to save and obtain the images from the cloud.
I read that firebaseStorage does not cache automatically any image, so I think I'll build my own logic to cache all the downloaded images.
My doubt comes when I read the getData() method documentation, which says it will download the image into memory --> "Asynchronously downloads the object at the StorageReference to a list in memory."
I don't want to have duplicates when I start to cache all the downloaded images, so I would like to erase the information getData donwload to memory after caching the images, but to do that I first need to know where in the memory the method is downloading the photo data.
I created a method with path_provider that checks all the cache directories and persistency directories of internal and external storage of my phone after downloading an image from firebase storage and I cannot find any file/document with the photo information.
void getDirectories() async {
print('Getting permanent directory');
directoryPath = await getApplicationDocumentsDirectory();
print(directoryPath);
print('Getting support directory');
applicationSupportPath = await getApplicationSupportDirectory();
print(applicationSupportPath);
print('Getting cache directory');
temporaryPath = await getTemporaryDirectory();
print(temporaryPath);
print('Getting external data directories');
externalStorageDirectories = await getExternalStorageDirectories();
print(externalStorageDirectories);
print('Getting external data directory');
externalStoragePath = await getExternalStorageDirectory();
print(externalStoragePath);
print('Getting external cache directories');
externalCacheDirectories = await getExternalCacheDirectories();
print(externalCacheDirectories);
print('Separator');
print('separator');
print('The documents in $externalStoragePath are:');
await for (var documents in externalStoragePath.list()) {
print(documents);
}
print('The documents in $externalCachePath are:');
await for (var documents in externalCachePath.list()) {
print(documents);
}
print('The documents in $directoryPath are:');
await for (var documents in directoryPath.list()) {
print(documents);
}
print('The documents in $temporaryPath are:');
await for (var documents in temporaryPath.list()) {
print(documents);
}
print('The documents in $applicationSupportPath are:');
await for (var documents in applicationSupportPath.list()) {
print(documents);
}
print('The documents in $assetsDirectory are:');
await for (var documents in assetsDirectory.list()) {
print(documents);
}
print('The documents in $externalStoragePicturesPath are:');
await for (var documents in externalStoragePicturesPath.list()) {
print(documents);
}
And this is what I found:
So no document/file related to the photo...
Where does the getData() method downloads the information in memory?