0
  DatabaseReference databaseRef= FirebaseDatabase.instance.ref().child("collecton-name");

I am to display data from firebase, and so when I fetch information like below, I get this error.

FirebaseAnimatedList(
            query:databaseRef,
            itemBuilder:(BuildContext context, DataSnapshot snapshot,
            Animation<double>animation, int index){
              var x=snapshot.value['title'];
              print(x);
        return ListTile(
      subtitle: Text(snapshot.value['title']),
      title:Text(snapshot.value['subtitle'])
      );
      },
        ),

This is the error for the title, subtitle, and the variable.

The method '[]' can't be unconditionally invoked because the receiver can be 'null'.
Pratishtha S
  • 81
  • 2
  • 11

0 Answers0