sliver_tree/_synced_input_normalizer library

Input normalization for SyncedSliverTree's input modes.

Each mode's raw input (a nested SyncedTreeNode tree, nested domain objects, or flat items plus parent keys) is walked ONCE into a NormalizedTreeInput: TreeNode lists in render order, ready to feed TreeSyncController.syncRoots. Validation happens during the walk and throws ArgumentError naming the offending key, so a malformed input is rejected before any controller state is touched. There is no second validation layer behind these walks; each normalizer must reject every malformed shape on its own, in every build mode.

Names here are public despite the underscore-prefixed file: internality comes from barrel non-export, while the tests import this file directly to exercise each walk in isolation.

Classes

NormalizedTreeInput<TKey, TItem>
Immutable-by-convention normalized tree structure consumed by SyncedSliverTree's sync pass.

Functions

normalizeFlat<TKey, TItem>({required Iterable<TItem> items, required TKey keyOf(TItem item), required TKey? parentOf(TItem item)}) → NormalizedTreeInput<TKey, TItem>
Normalizes flat items plus parent keys (the .flat input mode).
normalizeHierarchy<TKey, TItem>({required Iterable<TItem> roots, required TKey keyOf(TItem item), required Iterable<TItem> childrenOf(TItem item)}) → NormalizedTreeInput<TKey, TItem>
Normalizes nested domain objects (the .hierarchy input mode).
normalizeSyncedNodes<TKey, TItem>(Iterable<SyncedTreeNode<TKey, TItem>> tree) → NormalizedTreeInput<TKey, TItem>
Normalizes a nested SyncedTreeNode tree (the default constructor's input mode).