doc method

  1. @override
DocumentRef doc([
  1. String? id
])
override

Returns a DocumentRef with the provided id.

If no id is provided, an auto-generated ID is used.

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

Implementation

@override
DocumentRef doc([String? id]) {
  id ??= int.parse(
          '${Random().nextInt(1000000000)}${Random().nextInt(1000000000)}')
      .toRadixString(35)
      .substring(0, 9);
  return DocumentRef(id, this);
}