insertAll method

void insertAll(
  1. Iterable<OverlayEntry> entries, {
  2. OverlayEntry? below,
  3. OverlayEntry? above,
})

Insert all the entries in the given iterable.

If below is non-null, the entries are inserted just below below. If above is non-null, the entries are inserted just above above. Otherwise, the entries are inserted on top.

It is an error to specify both above and below.

Implementation

void insertAll(Iterable<OverlayEntry> entries, { OverlayEntry? below, OverlayEntry? above }) {
  assert(_debugVerifyInsertPosition(above, below));
  assert(entries.every(_debugCanInsertEntry));
  if (entries.isEmpty) {
    return;
  }
  for (final OverlayEntry entry in entries) {
    assert(entry._overlay == null);
    entry._overlay = this;
  }
  setState(() {
    _entries.insertAll(_insertionIndex(below, above), entries);
  });
}