add method

Future<DocRef<D>> add(
  1. D data
)

Returns a DocumentReference with an auto-generated ID, after populating it with provided data.

The unique key generated is prefixed with a client-generated timestamp so that the resulting list will be chronologically-sorted.

Implementation

Future<DocRef<D>> add(D data) async {
  final DocRef<D> newDocument = doc();
  await newDocument.set(data);
  return newDocument;
}