withConverter<U> method

  1. @mustBeOverridden
Query<U> withConverter<U>({
  1. required FromFirestore<U> fromFirestore,
  2. required ToFirestore<U> toFirestore,
})

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

@mustBeOverridden
Query<U> withConverter<U>({
  required FromFirestore<U> fromFirestore,
  required ToFirestore<U> toFirestore,
}) {
  return Query<U>._(
    firestore: firestore,
    queryOptions: _queryOptions.withConverter(
      (
        fromFirestore: fromFirestore,
        toFirestore: toFirestore,
      ),
    ),
  );
}