generateSessionEntryId function

String generateSessionEntryId(
  1. Map<String, SessionRecord> byId
)

Implementation

String generateSessionEntryId(Map<String, SessionRecord> byId) {
  for (var i = 0; i < 100; i++) {
    // The uuidv7 prefix is timestamp-derived and nearly constant between
    // calls, so short ids must come from the random tail.
    final id = uuidv7().substring(uuidv7().length - 8);
    if (!byId.containsKey(id)) return id;
  }
  return uuidv7();
}