removeItemAt method

T? removeItemAt(
  1. int index
)

Implementation

T? removeItemAt(int index) {
  assert(
    index.clamp(0, _relationship.length - 1) == index,
    'Out of items range [${0}-${_relationship.length}]:$index',
  );
  final List<T?> items = _relationship.values.map((e) => e?.item).toList();
  final slot = _relationship.keys.elementAt(index);
  final child = _relationship[slot];
  _relationship[slot] = null;
  reorder();
  if (mounted) {
    _updateSlots();
    setState(() {});
  }
  widget.onChanged?.call(items);
  return child?.item;
}