Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I want to upload array of data into firebase using flutter I do not know how to upload array of data from firebase please help me to solve this by providing some examples of codes.
Here is a example to upload data to Firestore using Dart (Flutter):
static example() async {
var array = ["item1", "item2"];
await FirebaseFirestore.instance.ref
.collection("myCollection")
.doc("myDocument")
.set({"myArray": array});
}
Find more about data types and firestore here: https://firebase.google.com/docs/firestore/manage-data/data-types
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 months ago.
Improve this question
How to update a firebase document using Transactions or ID in Flutter?
final _firestore = FirebaseFirestore.instance;
_firestore
.collection("///Here your collection name")
.doc("///Here your Document ID")
.update({'///Field name':/// new value});
Hope this will help you.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Can we achieve by querying snapshots of all documents in a collection that seen and whose values are set to be false using for loop? Or will we have to use firebase functions for that? Thank you.
For ChatApp you can add a is seen attribute to your message like the below:
-La42yee6vzxZ2hbZy2R
isseen: true
message: "u"
reciever: "7bVO6TsEJtTPaO2bRqWL6ZzFrkg1"
sender: "4z27uqrIVCMJ96hfI6Y5qzIxHav1"
When the sender send a new message you must set isseen property to false, and when the receiver opens the chat page you must change isseen to true.
I hope this work for you.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
Currently, I am writing a cloud function, i need a way to get the device id tokens of some devices, which i have stored in a field of a collection in a document.
How can I access it?
Please help, i'm stuck at this.
You can try code:
firebaseMessaging.getToken().then((token) {
Firestore.instance.collection('collectionName').document(currentUserId).updateData({'pushToken': token});
})
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
Flutter Firebase realtime once().then() doesn't get updated when rerun
when I use once.then to read data if I run it again it won't update variables or give out null
The once() method does precisely what its name implies: it reads the data once, and doesn't monitor for updates. As the documentation says:
Listens for a single value event and then stops listening.
To get realtime update, use one of the on... streams such as onValue which:
Fires when the data at this location is updated.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
just wondering how to retrieve data writed by a specific user using angular2 and firebase without using filter and map. if there is a way.
I think that you could use the equalTo query:
var ref = new Firebase('https://something.firebaseio.com/posts');
ref.orderByChild('sender').equalTo('some user').on("child_added", (snapshot) => {
console.log(snapshot.key());
});
In this case, a sender attribute must be present
See this link for more details:
https://www.firebase.com/docs/web/api/query/equalto.html