IdAllocator constructor

IdAllocator({
  1. int? session,
  2. Set<int>? excludedSessions,
  3. Random? random,
})

Creates an allocator. Pass an explicit session to resume a known session, or excludedSessions (the salts already used in a loaded document) to draw a fresh salt that avoids them. random is seedable for deterministic tests.

Implementation

IdAllocator({int? session, Set<int>? excludedSessions, Random? random})
  : session =
        session ?? _drawSession(random ?? Random.secure(), excludedSessions);