-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Open
@jagomf Collection converters support for
Description
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
Userdoes havefromFirebaseconstructor andtoFirebasemethod. - Class
Eventhas atoFirebasemethod but cannot have afromFirebaseconstructor: instantiating anEventclass requires not only retrieving data fromeventscollection, but also awaiting to resolve a document fromuserscollection once I got the document fromeventsand have access to its associateduser.
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 :)