setItems method
Replaces all items under sectionKey. Diffs against current
children and animates inserts/removes.
Implementation
void setItems(K sectionKey, Iterable<Item> items, {bool animate = true}) {
_checkNotDisposed();
_requireSection(sectionKey, "setItems");
// Re-initialize tracking so the diff is computed against the actual
// current state — see [setSections] for the rationale.
_sync.initializeTracking();
final desired = <TreeNode<SecKey<K>, SecPayload<Section, Item>>>[
for (final i in items)
TreeNode(
key: ItemKey<K>(itemKeyOf(i)),
data: ItemPayload<Section, Item>(i),
),
];
_sync.syncChildren(SectionKey<K>(sectionKey), desired, animate: animate);
}