core/tree/stable_ids library

Classes

StableIdAssigner
StableIdAssignment
Parallel arrays aligned with NormalizedTree.nodes.

Functions

contentDisambiguator(String text, String normalized) → String
A scroll-stable disambiguator for a colliding text slug, from the tokens the slug dropped: their slug when short (15 Oct ₹500 paid → 15_500), else a 6-hex FNV-1a hash of the full normalized text. '' when nothing was dropped (identical slugs then fall back to a counter).
generateStableId({required String parentPath, required String role, required int siblingPosition, String identifier = '', String text = '', int? disambiguator}) → String
Build a human-readable, deterministic stable ID for one tree node.
idDroppedTokens(String text) → List<String>
The data-bearing tokens idTextSlug drops from text (every whitespace-separated token whose first ASCII alphanumeric is a digit), in order: 15 Oct ₹500 paid → [15, ₹500].
idTextSlug(String text, {int maxLength = 24}) → String
The text slug used for an ID, with data-bearing tokens removed: every whitespace-separated token whose first alphanumeric character is a digit (prices, counts, percentages, dates, OTPs — "₹8,994", "+359.55%", "169", "12th"). A label made only of such tokens yields '' and the caller falls back to the structural role_n slug, so a node named by a live value ("NIFTY50 22716.20 (-0.28 %)") keeps one ID across value changes instead of minting a new node every tick.
slugify(String input, {int maxLength = 24}) → String
Lower-case, ASCII-alphanumeric slug.