insert method Null safety
- OverlayEntry entry,
- {OverlayEntry? below,
- 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(!_entries.contains(entry), 'The specified entry is already present in the Overlay.');
assert(entry._overlay == null, 'The specified entry is already present in another Overlay.');
entry._overlay = this;
setState(() {
_entries.insert(_insertionIndex(below, above), entry);
});
}