addItem method

void addItem(
  1. Item item, {
  2. required K toSection,
  3. int? index,
  4. bool animate = true,
})

Inserts item under toSection at index (or at the end).

Implementation

void addItem(
  Item item, {
  required K toSection,
  int? index,
  bool animate = true,
}) {
  _checkNotDisposed();
  _requireSection(toSection, "addItem");
  _tree.insert(
    parentKey: SectionKey<K>(toSection),
    node: TreeNode(
      key: ItemKey<K>(itemKeyOf(item)),
      data: ItemPayload<Section, Item>(item),
    ),
    index: index,
    animate: animate,
  );
}