add method

void add(
  1. T item, {
  2. bool mountToTop = true,
  3. Duration duration = const Duration(milliseconds: 200),
  4. Curve curve = Curves.easeInOut,
})

Add new item to Dashboard.

If itemStorageDelegate is not null, DashboardItemStorageDelegate.onItemsAdded will call with added item and its new layout. It is 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 add(T item,
    {bool mountToTop = true,
    Duration duration = const Duration(milliseconds: 200),
    Curve curve = Curves.easeInOut}) {
  if (_isAttached) {
    _items[item.identifier] = item;
    _layoutController!
        .add(item, mountToTop: mountToTop, duration: duration, curve: curve);
    itemStorageDelegate?._onItemsAdded(
        [_getItemWithLayout(item.identifier)], _layoutController!.slotCount);
  } else {
    throw Exception("Not Attached");
  }
}