FirebaseQuery<T> class

A type-safe wrapper for Firestore queries.

Provides a fluent interface for building and executing Firestore queries with proper type conversion. The generic type T represents the model class for the query results.

Example:

final activeUsers = usersCollection
  .query()
  .where('status', isEqualTo: 'active')
  .where('age', isGreaterThan: 18)
  .orderBy('lastSeen', descending: true)
  .limit(10);

// Get results once
List<User> users = await activeUsers.get();

// Or listen to real-time updates
activeUsers.stream().listen((users) {
  print('Got ${users.length} active users');
});

Constructors

FirebaseQuery({required Query<Object?> query, required T fromJson(Map<String, dynamic>, String)})
Creates a new FirebaseQuery instance.

Properties

fromJson → T Function(Map<String, dynamic>, String)
Function to convert Firestore data to type T
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

get() Future<List<T>>
Executes the query once.
getWithPagination() Future<QueryResult<T>>
Executes the query with pagination support.
limit(int limit) FirebaseQuery<T>
Limits the number of documents returned.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
orderBy(String field, {bool descending = false}) FirebaseQuery<T>
Orders the query results by a field.
stream() Stream<List<T>>
Creates a real-time stream of the query results.
toString() String
A string representation of this object.
inherited
where(String field, {dynamic isEqualTo, dynamic isNotEqualTo, dynamic isLessThan, dynamic isLessThanOrEqualTo, dynamic isGreaterThan, dynamic isGreaterThanOrEqualTo, dynamic arrayContains, List? arrayContainsAny, List? whereIn, List? whereNotIn, bool? isNull}) FirebaseQuery<T>
Filters the query based on a field value.

Operators

operator ==(Object other) bool
The equality operator.
inherited