insert method

void insert(
  1. OverlayEntry entry, {
  2. OverlayEntry? below,
  3. OverlayEntry? above,
})

Insert the given entry into the overlay.

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

It is an error to specify both above and below.

Implementation

void insert(OverlayEntry entry, { OverlayEntry? below, OverlayEntry? above }) {
  assert(_debugVerifyInsertPosition(above, below));
  assert(_debugCanInsertEntry(entry));
  entry._overlay = this;
  setState(() {
    _entries.insert(_insertionIndex(below, above), entry);
  });
}