insert method

void insert (OverlayEntry entry, { OverlayEntry above })

Insert the given entry into the overlay.

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

Implementation

void insert(OverlayEntry entry, { OverlayEntry above }) {
  assert(entry._overlay == null);
  assert(above == null || (above._overlay == this && _entries.contains(above)));
  entry._overlay = this;
  setState(() {
    final int index = above == null ? _entries.length : _entries.indexOf(above) + 1;
    _entries.insert(index, entry);
  });
}