Future uploadAndGetURL(File file) async { final storageRef = FirebaseStorage.instance.ref().child("images/${DateTime.now()}.jpg"); // Start the upload final uploadTask = storageRef.putFile(file); // Wait for completion final snapshot = await uploadTask.whenComplete(() => null); // Retrieve the URL from the same reference final String downloadUrl = await snapshot.ref.getDownloadURL(); print("File available at: $downloadUrl"); } Use code with caution. Source: Stack Overflow
Configured to allow read access to the requested files. How to Get a Download URL flutter firebase storage get download url
Retrieving a download URL is a fundamental task when building media-heavy apps with Flutter and Firebase . This URL serves as a long-lived, publicly accessible link to files stored in your Cloud Storage bucket, which can then be used in widgets like Image.network or passed to external download libraries. Before you begin, ensure you have: Future uploadAndGetURL(File file) async { final storageRef =
If you already know the path of the file in your storage bucket, you can retrieve its URL directly: This URL serves as a long-lived, publicly accessible