Collection constructor

Collection(
  1. Database database,
  2. String collectionId,
  3. {Document parentDocument,
  4. Serializers serializers,
  5. FullType fullType}
)

Constructs a collection.

Usually it's better to call the method database.collection("id") instead of this constructor.

This constructor enables specifying parentDocument, which is a concept supported by some document database vendor. It typically affects documents in the collection behave in transactions.

Implementation

Collection(
  this.database,
  this.collectionId, {
  this.parentDocument,
  this.serializers,
  this.fullType,
})  : assert(database != null),
      assert(collectionId != null) {
  ArgumentError.checkNotNull(database, 'database');
  if (collectionId == null || collectionId.isEmpty) {
    throw ArgumentError.value(collectionId, 'collectionId');
  }
}