Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use graphql to get data from Cloud Firestore from Firebase using flutter?

Is it possible to query results from Firestore firebase in flutter using graphql. I have to narrow down some results and have to bring them to the frontend. Please help me through this. Thanks in advance

like image 869
Surya Narayan Avatar asked Jan 15 '20 06:01

Surya Narayan


People also ask

Can I use GraphQL with firestore?

Using GraphQL with Firestore would not make things faster -- since Firebase SDKs already talk directly to the backend database the connection is as fast as it can be. GraphQL can be used with Firestore, but you would mostly do so if you had a specific reason to prefer the data composition or query patterns it enables.

Can I use GraphQL with Firebase?

Combine data in GraphQL Next to customer data, we also have order data in the Firebase Realtime Database. To combine the customer data with the order data, we need to create the query to get the orders from the Firebase Realtime Database. Both the schemas are linked in index. graphql in the project's root.


1 Answers

Yes, you are able to use GraphQL with Firestore, there is actually this other thread exploring this a little bit more in depth.

Summarizing that information, you first need to convert the results from Firestore (those you obtain with the .get method for example) into an array so that you can pass them to GraphQL.

There are also some examples online of this such as this git repository. You can use these as a guide in order to set your own implementation.

Hope you find this useful.

like image 107
rsalinas Avatar answered Nov 15 '22 07:11

rsalinas