Challenge - 5 Problems
Secure Storage Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ ui_behavior
intermediate2:00remaining
Securely storing and retrieving a password
Given the Flutter code below using flutter_secure_storage, what will be the output when retrieving the stored password after saving it?
Flutter
final storage = FlutterSecureStorage(); await storage.write(key: 'password', value: 'mySecret123'); String? pwd = await storage.read(key: 'password'); print(pwd);
Attempts:
2 left
💡 Hint
Think about what the read method returns after a successful write.
✗ Incorrect
The write method stores the value securely. The read method returns the stored value as a string if it exists, so it prints 'mySecret123'.
❓ lifecycle
intermediate2:00remaining
When to clear secure storage on logout?
In a Flutter app using flutter_secure_storage for credentials, when is the best time to clear stored credentials to keep the app secure?
Attempts:
2 left
💡 Hint
Think about user privacy and security after ending a session.
✗ Incorrect
Clearing credentials on logout ensures no sensitive data remains accessible if someone else uses the device.
📝 Syntax
advanced2:00remaining
Correct syntax for writing to secure storage
Which option shows the correct syntax to write a username 'user123' to flutter_secure_storage with key 'username'?
Flutter
final storage = FlutterSecureStorage();Attempts:
2 left
💡 Hint
Check the method name and parameter names carefully.
✗ Incorrect
The write method requires named parameters key and value and returns a Future, so await is needed.
🔧 Debug
advanced2:00remaining
Why does reading from secure storage return null?
A developer writes this code but reading the key 'token' returns null. What is the most likely cause?
Flutter
final storage = FlutterSecureStorage(); await storage.write(key: 'Token', value: 'abc123'); String? token = await storage.read(key: 'token'); print(token);
Attempts:
2 left
💡 Hint
Check the exact spelling and casing of keys used.
✗ Incorrect
flutter_secure_storage treats keys as case-sensitive strings, so 'Token' and 'token' are different keys.
🧠 Conceptual
expert2:00remaining
Why use flutter_secure_storage over SharedPreferences for credentials?
Which reason best explains why flutter_secure_storage is preferred for storing user credentials instead of SharedPreferences?
Attempts:
2 left
💡 Hint
Think about data encryption and protection on mobile devices.
✗ Incorrect
flutter_secure_storage uses platform-specific secure storage mechanisms with encryption, unlike SharedPreferences which stores plain text.