0
0
Fluttermobile~10 mins

Hive for NoSQL storage in Flutter - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to open a Hive box named 'settings'.

Flutter
var box = await Hive.[1]('settings');
Drag options to blanks, or click blank then click option'
AdeleteBox
BcloseBox
CopenBox
DcreateBox
Attempts:
3 left
💡 Hint
Common Mistakes
Using closeBox instead of openBox
Trying to createBox which doesn't exist
2fill in blank
medium

Complete the code to add a value 'dark' with key 'theme' to the box.

Flutter
await box.[1]('theme', 'dark');
Drag options to blanks, or click blank then click option'
Aget
Bput
Cdelete
Dclear
Attempts:
3 left
💡 Hint
Common Mistakes
Using get instead of put
Using delete or clear which remove data
3fill in blank
hard

Fix the error in the code to read the value for key 'username' from the box.

Flutter
var username = box.[1]('username');
Drag options to blanks, or click blank then click option'
Aput
Bclear
Cdelete
Dget
Attempts:
3 left
💡 Hint
Common Mistakes
Using put instead of get
Using delete or clear which remove data
4fill in blank
hard

Fill both blanks to delete the key 'token' and then close the box.

Flutter
await box.[1]('token');
await box.[2]();
Drag options to blanks, or click blank then click option'
Adelete
Bclose
Cput
Dget
Attempts:
3 left
💡 Hint
Common Mistakes
Using put or get instead of delete
Not closing the box properly
5fill in blank
hard

Fill all three blanks to create a map of all keys and values where values are not null.

Flutter
var allData = {for (var key in box.[1]) if (box.[3](key) != null) key: box.[2](key)};
Drag options to blanks, or click blank then click option'
Akeys
Bget
Dvalues
Attempts:
3 left
💡 Hint
Common Mistakes
Using values instead of keys for iteration
Using wrong method to get values