save method

Future<T> save()

Saves the document to Firestore. If the document does not exist, it will be created. If this document doesn't have an ID yet, a new ID will be generated and instantly updated, you don't have to wait for the Future to complete to get the ID.

Implementation

Future<T> save() async {
  if (_injectedPath == null) {
    assert(
        DogFirestoreEngine.instance.checkRootCollection<T>(),
        "This entity is not a root "
        "collection, and no parent has been set. Use withParent() to set the parent.");
  }
  var document = selfCollection.doc(id);
  id = document.id; // Set the auto-generated ID that is created by using a null ID
  await document.set(this as T);
  return this as T;
}