Reputation: 900
is it more efficient managing the database on flutter using http or databaseReference i just use http right now on flutter and i tried databaseReference Previously on java i think http is easier but i don't care which easier as long it gives me the best performance
http
http.post('https://flutter-course-36df8.firebaseio.com/' + 'products.josn',
databaseReference
final databaseReference = FirebaseDatabase.instance.reference();
void getData(){
databaseReference.once().then((DataSnapshot snapshot) {
print('Data : ${snapshot.value}');
});
}
Upvotes: 0
Views: 40
Reputation: 80944
You need to use the api provided by firebase, it is much better. For example FirebaseDatabase.instance
will retrieve the root node in the Firebase Database which is better than adding the url.
Also using databaseReference
you can retrieve data once
or on every change on the database.
Upvotes: 2