lite library

Firestore Lite: a Cloud Firestore client without a local cache, without listeners and without the sync engine. Every call is one request to the backend and one response, over gRPC on native platforms and over REST on the web. It is the Dart counterpart of firebase/firestore/lite of the JS SDK. Supported like the main library; docs/guides/lite.md lists how it differs from the JS SDK's Lite and what was verified.

import 'package:cloud_firestore_dart/lite.dart';

final FirebaseFirestore firestore = FirebaseFirestore.instanceFor(app: app);
await firestore.doc('cities/SF').set({'name': 'San Francisco'});
final QuerySnapshot<Map<String, Object?>> cities = await firestore
    .collection('cities')
    .where('name', isEqualTo: 'San Francisco')
    .get();

Import this library instead of cloud_firestore_dart.dart: both declare FirebaseFirestore, DocumentReference, Query and the snapshot classes (import one of them with a prefix to use both in one file). The value types (Timestamp, GeoPoint, Blob, FieldValue, FieldPath, Filter, ...) are the same classes in both libraries.

A program that only imports this library does not contain the sync engine, the local store or the SQLite layer of the main library.

Classes

AggregateField
Represents an aggregation that can be performed by Firestore.
AggregateQuery
A query that calculates aggregations (count, sum, average) over the result set of a Query on the server, without downloading the documents.
AggregateQuerySnapshot
The results of executing an AggregateQuery.
AverageAggregateField
Averages the values of a field over the result set.
Blob
An immutable sequence of bytes, the value of a bytes field in a document.
BsonObjectId
Represents a BSON ObjectId type in Firestore documents.
BsonTimestamp
Represents a BSON Timestamp type in Firestore documents.
CollectionReference<T extends dynamic>
A CollectionReference can be used for adding documents, getting document references, and querying for documents (using the methods inherited from Query).
CountAggregateField
Counts the documents in the result set.
Decimal128Value
Represents a 128-bit decimal type in Firestore documents.
DocumentReference<T extends dynamic>
A DocumentReference refers to a document location in a Firestore database and can be used to read or write that location. The document may or may not exist.
DocumentSnapshot<T extends dynamic>
A DocumentSnapshot contains the data read from a document in a Firestore database. The data can be extracted with data or get.
FieldPath
A FieldPath refers to a field in a document. The path may consist of a single field name (referring to a top level field in the document), or a list of field names (referring to a nested field in the document).
FieldValue
Special values for writes: they tell the server how to change a field instead of giving its new value.
Filter
A Filter represents a restriction on one or more field values and can be used to refine the results of a Query (see Query.where).
FirebaseFirestore
The entry point of Firestore Lite: a Cloud Firestore client without a local cache and without listeners. Every call is one request to the backend and one response.
FirestoreDataConverter<T>
Converts between the objects of an application and the maps Firestore stores, for references and queries made with withConverter.
GeoPoint
A geographic point, given by its latitude and longitude in degrees.
Int32Value
Represents a 32-bit integer type in Firestore documents.
MaxKey
Represents the Firestore "Max Key" data type, a value that sorts after every other value.
MinKey
Represents the Firestore "Min Key" data type, a value that sorts before every other value except null.
Query<T extends dynamic>
A Query which you can read. You can also construct refined Query objects by adding filters and ordering.
QueryDocumentSnapshot<T extends dynamic>
A QueryDocumentSnapshot contains the data of a document that exists: one read by a query, or handed to a converter. Its data is never null.
QuerySnapshot<T extends dynamic>
A QuerySnapshot contains the results of a query: zero or more QueryDocumentSnapshots, in the order of the query.
RegexValue
Represents a regular expression type in Firestore documents.
SetOptions
Chooses whether a set call replaces the whole document or merges the data into it.
Settings
The settings of a Firestore Lite instance: where the backend is.
SumAggregateField
Sums the values of a field over the result set.
Timestamp
A Timestamp represents a point in time independent of any time zone or calendar, represented as seconds and fractions of seconds at nanosecond resolution in UTC Epoch time. It is encoded using the Proleptic Gregorian Calendar which extends the Gregorian calendar backwards to year one. It is encoded assuming all minutes are 60 seconds long, i.e. leap seconds are 'smeared' so that no leap second table is needed for interpretation. Range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By restricting to that range, we ensure that we can convert to and from RFC 3339 date strings.
Transaction
A Transaction is passed to the function given to FirebaseFirestore.runTransaction, to read and write documents within the transaction.
VectorValue
A vector of doubles stored in a document field, for example an embedding for vector search.
WriteBatch
A write batch, used to perform multiple writes as a single atomic unit.

Enums

FirestoreErrorCode
The status code of a FirestoreException. The codes and their numeric values are the canonical gRPC status codes.
LogLevel
The verbosity of the Cloud Firestore logs, set with FirebaseFirestore.setLogLevel, from the most to the least verbose. Each level logs its own messages and those of every level after it. The JS SDK also has info; the SDK writes no message at that level, so it is left out.

Typedefs

Firestore = FirebaseFirestore
The 0.1 name of FirebaseFirestore.
FirestoreSettings = Settings
The 0.1 name of Settings.
FromFirestore<T> = T Function(QueryDocumentSnapshot<Map<String, Object?>> snapshot)
Reads a T from a document: the fromFirestore argument of withConverter.
ToFirestore<T> = Map<String, Object?> Function(T value, SetOptions? options)
Turns a T into the data written for a document: the toFirestore argument of withConverter.

Exceptions / Errors

FirestoreException
The exception thrown by Firestore operations. errorCode says what went wrong.