appsup-dart / firebase_dart

A pure Dart implementation of the Firebase client
Other
91 stars 30 forks source link

How to do? Firestore Database #19

Closed anandsubbu007 closed 2 years ago

anandsubbu007 commented 2 years ago

Hi, I'm New to this.

may I know how to push and fetch data To & From Firebase Database.

i tried but it doesn't works

 var ref = db.reference().child('test');
    await ref.set({
      'Value': {'One': 1, 'Two': 2, 'Three': 3}
    });
    await ref.set({'Box': json});
    await ref.update({"Box": json});

Thanks For Your Contribution.

rbellens commented 2 years ago

Can you give a bit more context? Maybe a full example of what is failing? Do you get an error?

anandsubbu007 commented 2 years ago

Function run completely. No error found.

When I check my firebase db manually. There is no change in firebase db.

rbellens commented 2 years ago

I'm afraid, I won't be able to help you if I don't get any more info. The code above should work. So, maybe there is some problem in the initialization or something, but I would need the full example code to judge.

anandsubbu007 commented 2 years ago

Does it supports Firestore Database in Firebase?

rbellens commented 2 years ago

no, only realtime database, storage and authentication for now

rbellens commented 2 years ago

Ah, yes, but you're using an in memory database url mem://Subbu.App/. This creates a database in the local memory and won't synchronize with any server. Main purpose for an in memory database is for unit testing. You should instead use an url that points to the actual database. In general, this is something like: https://my-project.firebaseio.com. Probably, it is already part of your firebaseConfig variable, so you don't need to explicitly add it anymore when you create the FirebaseDatabase instance. Simply, do:

var db = FirebaseDatabase(app: firebaseApp);