I am learning android app development in flutter. I have started from flutter chat app example. In the Enable data syncing section , It is explained to use Firebase Database like below.
final DBreference = FirebaseDatabase.instance.reference().child('messages');
Also the push()
and set()
methods are working fine.
When i try to listen to events on child using ValueEventListener
.
The DBreference
created above has no methods like addListenerForSingleValueEvent
or addValueEventListener
.
My main goal is to retrieve value of child as expalined in SO answers Retrieving child value -firebase- or Checking if a particular value exists in the firebase database
I m getting undefined class ValueEventListener
if i create a new ValueEventListener
, i tried by importing
import 'com.google.firebase.database.ValueEventListener';
I m unable to import this path as well.
Same error for addListenerForSingleValueEvent
or addValueEventListener
.
I am using android studio 3.1