🐛 [cloud_firestore] Future collection converter

オープン
#17,237 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
dart, flutter
領域
database

調査の方向性

エントリーポイントは cloud_firestore の withConverter API です。まず、現在の fromFirestore コールバックの契約と、collection および document の変換経路を追跡してください。既存の同期 converter との互換性を維持しながら、非同期 converter が Event の関連データを解決でき、埋め込み User/Event のユースケースをカバーできれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
Dart
スター
9.3k
フォーク
4.1k
平均マージ
2日 10時間
マージ済み PR(30日)
78

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

firebase/flutterfire のほかの issue

firebase/flutterfire の issue をすべて見る

似ている issue

Dart の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。