withConverter<U> method
CollectionReference<U>
withConverter<U>({
- required FromFirestore<
U> fromFirestore, - required ToFirestore<
U> toFirestore,
override
Applies a custom data converter to this Query, allowing you to use your own custom model objects with Firestore. When you call get on the returned Query, the provided converter will convert between Firestore data and your custom type U.
Using the converter allows you to specify generic type arguments when storing and retrieving objects from Firestore.
Implementation
@override
CollectionReference<U> withConverter<U>({
required FromFirestore<U> fromFirestore,
required ToFirestore<U> toFirestore,
}) {
return CollectionReference<U>._(
firestore: firestore,
path: _queryOptions.parentPath._append(id) as _QualifiedResourcePath,
converter: (
fromFirestore: fromFirestore,
toFirestore: toFirestore,
),
);
}