NamedQuery<T> constructor

const NamedQuery<T>(
  1. String queryName
)

Defines a named query, allowing the ODM to generate utilities to interact with the query in a type-safe way.

By doing:

@NamedQuery<Person>('my-query-name')
@Collection<Person>(...)
class Anything {}

The ODM will generate a myQueryNameGet utility, which can be used as followed:

void main() async {
  Future<PersonSnapshot> snapshot = myQueryNameGet();
}

Note: Named queries must be associated with a Collection that has a matching generic argument.

This is necessary to ensure that FirestoreDocumentSnapshot.reference is properly set.

Implementation

const NamedQuery(this.queryName);