IdAllocator class

Mints fresh LocalIds for one editing session of a document.

Each allocator draws one random 32-bit session salt and hands out monotonically increasing indices, so every id it mints is unique and never reused. Continuing to edit a loaded document uses a new allocator with a new session salt (pass excludedSessions to guarantee it differs from sessions already present in the document), so newly minted ids never collide with existing ones.

Constructors

IdAllocator({int? session, Set<int>? excludedSessions, 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.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
session int
This allocator's 32-bit session salt; every minted id carries it.
final

Methods

mint() LocalId
Mints the next unique LocalId for this session.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited