generateId static method

String generateId()

Generates IDs in increasing time order within the current isolate.

A random suffix distinguishes simultaneous captures in separate isolates or browser tabs that share the same queue.

Implementation

static String generateId() {
  _lastMicros = max(DateTime.now().microsecondsSinceEpoch, _lastMicros + 1);
  // Letters avoid adding digits that could trigger a card-number filter.
  final suffix = String.fromCharCodes(
    Iterable.generate(10, (_) => 0x61 + _random.nextInt(26)),
  );
  return 'r_${_lastMicros.toRadixString(36)}_$suffix';
}