🐛 [cloud_firestore] Future collection converter

Aperta
#17,237 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
dart, flutter
Ambito
database

Direzione di ricerca

Il punto di ingresso è l’API withConverter di cloud_firestore; per prima cosa traccia il contratto attuale del callback fromFirestore e i relativi percorsi di conversione per collection e documenti. Il lavoro è completato quando un converter asincrono può risolvere dati correlati per un Event, mantenendo al contempo la compatibilità dei converter sincroni esistenti, con una copertura del caso d’uso User/Event incorporato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Needs Attention plugin: cloud_firestore type: enhancement

Collection converters support for Future

I want to request that withConverter supports a Future for its fromFirestore argument.

Use case

In some cases, like mine, one entity/data object has another one embedded.

Imagine a collection users and a collection events. Documents in collection events have one reference to a document in users.

In my Flutter app, there is class User and a class Event. Class Event has a member user that holds a User object.

  • Class User does have fromFirebase constructor and toFirebase method.
  • Class Event has a toFirebase method but cannot have a fromFirebase constructor: instantiating an Event class requires not only retrieving data from events collection, but also awaiting to resolve a document from users collection once I got the document from events and have access to its associated user.

If I could use a Future factory function to construct my Event object, I would be able to use fromFirebase and leverage type safe conversions.

Hope to have explained myself and my use case, and even though I don't think this will be implemented, I just wanted to say that it would be really useful :)

Lingua principale
Dart
Stelle
9.3k
Fork
4.1k
Merge medio
2g 10h
PR unite (30g)
78

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di firebase/flutterfire

Tutte le issue di firebase/flutterfire

Issue simili

Altre issue su Dart

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.