0
0
Fluttermobile~20 mins

Secure storage for credentials in Flutter - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Secure Storage Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
ui_behavior
intermediate
2: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);
Anull
BmySecret123
CThrows a runtime error
DEmpty string
Attempts:
2 left
💡 Hint
Think about what the read method returns after a successful write.
lifecycle
intermediate
2: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?
AWhen the user logs out
BWhen the app starts
COnly when the app is uninstalled
DNever clear stored credentials
Attempts:
2 left
💡 Hint
Think about user privacy and security after ending a session.
📝 Syntax
advanced
2: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();
Aawait storage.write(key: 'username', value: 'user123');
Bstorage.write('username', 'user123');
Cstorage.write(key='username', value='user123')
Dawait storage.set('username', 'user123');
Attempts:
2 left
💡 Hint
Check the method name and parameter names carefully.
🔧 Debug
advanced
2: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);
AThe write method failed silently
Bflutter_secure_storage does not support string values
CThe read method requires a callback
DKey names are case-sensitive, so 'Token' and 'token' differ
Attempts:
2 left
💡 Hint
Check the exact spelling and casing of keys used.
🧠 Conceptual
expert
2: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?
Aflutter_secure_storage stores data in plain text for easy access
BSharedPreferences is faster and more secure
Cflutter_secure_storage encrypts data and stores it securely on device hardware
DSharedPreferences automatically clears data on app close
Attempts:
2 left
💡 Hint
Think about data encryption and protection on mobile devices.