var teclas = snap.value.keys;
@override
void initState() {
super.initState();
final ref = FirebaseDatabase.instance.ref().child('employee');
ref.once().then((snap){
//TO retrieve all the documents from collection
dynamic keys = snap.snapshot.value;
//To get only the document IDs of all documents.
dynamic KEYS = keys.keys;
dynamic data = snap.snapshot.value;
for (var key in KEYS){
Employee d = new Employee(
id : data [key]['id'],
name : data[key]['name'],
email : data[key]['email'],
emp_id: data[key]['emp_id']
);
myAllData.add(d);
}
setState(() {
print('Length : ${myAllData.length}');
});
});
Aso Ndubuisi