insertAll method Null safety
- Iterable<
OverlayEntry> entries, - {OverlayEntry? below,
- 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((OverlayEntry entry) => !_entries.contains(entry)),
'One or more of the specified entries are already present in the Overlay.',
);
assert(
entries.every((OverlayEntry entry) => entry._overlay == null),
'One or more of the specified entries are already present in another Overlay.',
);
if (entries.isEmpty) {
return;
}
for (final OverlayEntry entry in entries) {
assert(entry._overlay == null);
entry._overlay = this;
}
setState(() {
_entries.insertAll(_insertionIndex(below, above), entries);
});
}