Skip to content

🐛 [cloud_firestore] Future collection converter #17237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jagomf opened this issue Mar 28, 2025 · 0 comments
Open

🐛 [cloud_firestore] Future collection converter #17237

jagomf opened this issue Mar 28, 2025 · 0 comments
Labels
Needs Attention This issue needs maintainer attention. plugin: cloud_firestore type: enhancement New feature or request

Comments

@jagomf
Copy link

jagomf commented Mar 28, 2025

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 :)

@jagomf jagomf added Needs Attention This issue needs maintainer attention. type: enhancement New feature or request labels Mar 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Attention This issue needs maintainer attention. plugin: cloud_firestore type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants