Skip to content

PushIdGenerator

Utility class for generating CARP document keys.

This code is taken from the Flutter cloud_firestore package supporting Firebase. This code is based on a Firebase blog post and ported to Dart. https://firebase.googleblog.com/2015/02/the-2120-ways-to-ensure-unique_68.html

Constructors

PushIdGenerator

PushIdGenerator()

Constants

PUSH_CHARS

String const PUSH_CHARS

The 64 characters used in generated keys, in sort order.

Methods

generatePushChildName

String generatePushChildName()

Generates a unique 20-character key.

The first 8 characters encode the current time, so keys sort by creation time. Used by CollectionReference.document when no name is given.