detach method Null safety
override
Mark this node as detached.
Typically called only from the parent's detach, and by the owner to mark the root of a tree as detached.
Subclasses with children should override this method to first call their inherited detach method, and then detach all their children.
Implementations of this method should end with a call to the inherited
method, as in super.detach()
.
Implementation
@override
void detach() {
super.detach();
if (_rowDecorationPainters != null) {
for (final BoxPainter? painter in _rowDecorationPainters!) {
painter?.dispose();
}
_rowDecorationPainters = List<BoxPainter?>.filled(_rowDecorations!.length, null);
}
for (final RenderBox? child in _children) {
child?.detach();
}
}