downloadFile method
Downloads a file from Firebase Storage.
storagePath
: The path in Firebase Storage of the file to download.
Example: uploads/images/file.jpg
destinationPath
: The local path where the file should be saved.
Example: /local/path/to/download/file.jpg
Returns a Future that resolves once the file has been downloaded and saved locally.
Implementation
Future<void> downloadFile(
{required String storagePath, required String destinationPath}) async {
File downloadToFile = File(destinationPath);
Reference storageReference = FirebaseStorage.instance.ref(storagePath);
await storageReference.writeToFile(downloadToFile);
}