addAll method

void addAll(
  1. List<T> items, {
  2. bool mountToTop = true,
})

Add new multiple items to Dashboard.

If itemStorageDelegate is not null, DashboardItemStorageDelegate.onItemsAdded will call with added items and their new layouts. They are placed wherever possible. The new layoutData may not be the same as the one added.

If the location of the added item is defined, it is tried to be placed in the location first. If there is a conflict or overflow and Dashboard.shrinkToPlace is true, it is tried to be placed by shrinking. In this case, if there is more than one possibility, it is placed in the largest form.

Implementation

void addAll(List<T> items, {bool mountToTop = true}) {
  if (_isAttached) {
    _items.addAll(
        items.asMap().map((key, value) => MapEntry(value.identifier, value)));
    _layoutController!.addAll(items);
    itemStorageDelegate?._onItemsAdded(
        items.map((e) => _getItemWithLayout(e.identifier)).toList(),
        _layoutController!.slotCount);
  } else {
    throw Exception("Not Attached");
  }
  throw 0;
}