itemsOf method

List<Item> itemsOf(
  1. K sectionKey, {
  2. bool includeExiting = false,
})

Item payloads under sectionKey in render order. Excludes pending-deletion items unless includeExiting is true. Returns [] for unknown sections.

Implementation

List<Item> itemsOf(K sectionKey, {bool includeExiting = false}) {
  _checkNotDisposed();
  final children = includeExiting
      ? _tree.getChildren(SectionKey<K>(sectionKey))
      : _tree.getLiveChildren(SectionKey<K>(sectionKey));
  if (children.isEmpty) {
    return const [];
  }
  final out = <Item>[];
  for (final k in children) {
    if (!_assertIsItem(k)) {
      continue;
    }
    final node = _tree.getNodeData(k);
    if (node == null) {
      continue;
    }
    final data = node.data;
    if (data is ItemPayload<Section, Item>) {
      out.add(data.value);
    }
  }
  return out;
}