rannes
rannes

Reputation: 99

how to get values from firebase database using flutter

I try to experience Firebase Live database with flutter. I just would like to get a value in the datasnapshot of the firebase response.

Upvotes: 0

Views: 5704

Answers (2)

Danylo
Danylo

Reputation: 5408

Check this example application in Flutter's Firebase Database plugin.

Upvotes: 1

Adrian Avram
Adrian Avram

Reputation: 957

For this you will want to use a FirebaseAnimatedList. All you have to do is pass in is the reference to your database then you can access your data using snapshot.value.

return FirebaseAnimatedList(
    query: FirebaseDatabase.instance.reference().child('users/' + user.uid),
    itemBuilder: (context, snapshot, animation, index) {
      return Row(children: <Widget>[
        Text(
          snapshot.value['source'],
          style: TextStyle(fontSize: 13.0),
        ),
      ]);
    });

Upvotes: 2

Related Questions