I have a Firebase Realtime Database and I want to write to it, that s simple enough, but I have added more than one tree to my Database and want to know how to write to the second tree. Right now I can only write to the first tree.
Image for better understanding:
So for example how can I write to the Color info.
Note: The first line of string (User line in image) is the users id token (currentFirebaseUser.uid) //uid = User ID and the second line of string(Info line in image) is automatically generated by firebase
Database code:
_getDBRides() {
return Expanded(
child: FirebaseAnimatedList(
query: dbRef,
itemBuilder: (BuildContext context, DataSnapshot snapshot,
Animation<double> animation, int index) {
Map Rides = snapshot.value as Map;
//unique key/id of each item in db
Rides[ key ] = snapshot.key;
return listItem(Rides: Rides);
},
),
);
}`
Button(
onTap: () {
if (_validateDate() == true) {
ref.child( Rides/${user.uid} ).push().set({
//Info saved in database
}).asStream();
_titleController.clear();
}
},
),
If there is one tree in the database then I can reference it like this
Rides[ Color ]
But because there is another tree I don t know how to write to it
What I have tried: Rides[ key ][ Color ]
doesn t work
Seems short but I have tried writing it in different ways too to see how to write to that tree but nothing work and the documentation doesn t seem to show how to write to a second tree.