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
sessionto resume a known session, orexcludedSessions(the salts already used in a loaded document) to draw a fresh salt that avoids them.randomis seedable for deterministic tests.
Properties
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