cachapa / firedart

A dart-native implementation of the Firebase Auth and Firestore SDKs
https://pub.dev/packages/firedart
Apache License 2.0
174 stars 62 forks source link

Add support for .stream of a query (QueryReference) #122

Open penguisnt opened 1 year ago

penguisnt commented 1 year ago

Currently, there is only .stream support for CollectionReference.stream and DocumentReference.stream, but if you put a query clause and get a QueryReference, it does not contain a .stream method to observe the query.

cachapa commented 1 year ago

If I remember correctly this is because at the time it wasn't possible to watch queries.

Is it possible now with the official SDK? If so, then it might make sense to regenerate the RPC code with the latest protobuffs and see if the methods are available.

Unfortunately I'm not able to do that myself, but would be happy to accept contributions.

ogtechdevs commented 7 months ago
Ouvir -- rpc Listen(ListenRequest) returns (ListenResponse)Ouve as mudanças. Este método está disponível apenas via gRPC ou WebChannel (não REST).Escopos de autorizaçãoRequer um dos seguintes escopos de OAuth:https://www.googleapis.com/auth/datastorehttps://www.googleapis.com/auth/cloud-platformPara saber mais, consulte a Visão geral da autenticação. Ouvir rpc Listen([ListenRequest](https://firebase.google.com/docs/firestore/reference/rpc/google.firestore.v1?hl=pt-br#google.firestore.v1.ListenRequest)) returns ([ListenResponse](https://firebase.google.com/docs/firestore/reference/rpc/google.firestore.v1?hl=pt-br#google.firestore.v1.ListenResponse)) Ouve as mudanças. Este método está disponível apenas via gRPC ou WebChannel (não REST). Escopos de autorização Requer um dos seguintes escopos de OAuth: https://www.googleapis.com/auth/datastore https://www.googleapis.com/auth/cloud-platform Para saber mais, consulte a [Visão geral da autenticação](https://cloud.google.com/docs/authentication/?hl=pt-br).
ogtechdevs commented 7 months ago

To build stream from firestore, will need this.

https://firebase.google.com/docs/firestore/reference/rpc/google.firestore.v1?hl=pt-br#google.firestore.v1.Firestore.Listen

cachapa commented 7 months ago

The RPC stubs have been recently regenerated from the latest versions, so they may already be available in the project.

If that's the case, then it would be a simple plumbing issue. Contributions are, as always, welcome :-)

ogtechdevs commented 7 months ago

Whats the problem to build the stream document().snapshot(); ?

I want know how current step to help with some contribuitions.

How we can do some contribuition?

cachapa commented 7 months ago

You might start by copying the query method and try to get the new one to return a Stream: https://github.com/cachapa/firedart/blob/master/lib/firestore/firestore_gateway.dart#L141