Complete the code to initialize the Firebase Realtime Database instance.
final database = FirebaseDatabase.instance[1];The FirebaseDatabase.instance.ref() method gets a reference to the root of the database.
Complete the code to write data to the 'users' node in the database.
database.ref('users').[1]({'name': 'Alice', 'age': 25});
The set method writes data to the specified database reference, replacing any existing data.
Fix the error in the code to listen for realtime updates on the 'messages' node.
database.ref('messages').on[1]((event) { final data = event.snapshot.value; print(data); });
The onValue event listens for any changes to the data at the reference and returns the snapshot.
Fill both blanks to update the 'status' field to 'online' for user with id 'user123'.
database.ref('users/[1]').[2]({'status': 'online'});
Use the user ID 'user123' as the child path and update to change only the 'status' field without overwriting other data.
Fill all three blanks to remove the 'age' field from user 'user456'.
database.ref('users/[1]').[2]({'[3]': null});
To remove a field, update it with null. Use the user ID 'user456' and the update method to remove only the 'age' field.