FirestoreCollectionModel<T extends FirestoreDocumentModel> constructor

FirestoreCollectionModel<T extends FirestoreDocumentModel>(
  1. String path, [
  2. List<T>? value
])

Base class for holding and manipulating data from a firestore database as a collection of FirestoreDocumentModel.

The load() method retrieves the value from the firestore database and the save() method saves the value to the firestore database.

When listen() is executed, changes in the number of elements in the Firestore collection are monitored and updated in real time.

Each document's change is notified only to the documents in it.

Implementation

FirestoreCollectionModel(String path, [List<T>? value])
    : assert(
        !(path.splitLength() <= 0 || path.splitLength() % 2 != 1),
        "The path hierarchy must be an odd number: $path",
      ),
      _rawPath = path,
      path = path.trimQuery(),
      parameters = _getParameters(path),
      super(value ?? []);