Challenge - 5 Problems
Cloud Storage Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ ui_behavior
intermediate2:00remaining
Uploading a file to Firebase Storage
What will happen when this Flutter code runs and the user selects a file to upload?
Flutter
final storageRef = FirebaseStorage.instance.ref().child('uploads/myfile.txt'); final file = File('/path/to/file.txt'); await storageRef.putFile(file); final url = await storageRef.getDownloadURL(); print(url);
Attempts:
2 left
💡 Hint
Check how the storage reference path and file upload method are used.
✗ Incorrect
The code correctly creates a reference to 'uploads/myfile.txt', uploads the file, then fetches and prints the download URL. 'putFile' accepts a File object, and 'await' is used properly.
❓ lifecycle
intermediate2:00remaining
Handling upload progress in Flutter
Which code snippet correctly listens to upload progress events from Firebase Storage in Flutter?
Flutter
final storageRef = FirebaseStorage.instance.ref('uploads/photo.png'); final uploadTask = storageRef.putFile(file); // Which code below correctly listens to progress?
Attempts:
2 left
💡 Hint
Look for the official property that streams upload snapshots.
✗ Incorrect
The 'snapshotEvents' stream provides TaskSnapshot objects with bytesTransferred and totalBytes, allowing progress calculation.
🔧 Debug
advanced2:00remaining
Fixing a permission denied error on upload
A Flutter app using Firebase Storage gets a 'permission denied' error when uploading files. Which Firebase Storage security rule causes this?
Flutter
rules_version = '2'; service firebase.storage { match /b/{bucket}/o { match /{allPaths=**} { allow read; allow write: if false; } } }
Attempts:
2 left
💡 Hint
Check the condition after 'allow write'.
✗ Incorrect
The rule explicitly denies all writes by using 'if false', so uploads fail with permission denied.
🧠 Conceptual
advanced2:00remaining
Understanding Firebase Storage download URLs
What is true about the download URL returned by Firebase Storage's getDownloadURL() method?
Attempts:
2 left
💡 Hint
Think about how Firebase Storage URLs are designed for sharing.
✗ Incorrect
The download URL is a long, unique link that allows public access to the file without authentication until the file or rules change.
expert
3:00remaining
Managing file upload state across app navigation
In a Flutter app, a file upload starts on Screen A. The user navigates to Screen B before upload finishes. How to ensure upload progress updates still show on Screen B?
Attempts:
2 left
💡 Hint
Think about how to share data between screens in Flutter.
✗ Incorrect
Using shared state management allows multiple screens to listen to the same upload task and update UI accordingly, even after navigation.