onUnmount property Null safety
final
Called when it is safe to dispose of children that were manually added to the renderBox.
Do not dispose the renderBox itself, as it will be disposed by the framework automatically. However, during that process the framework will check that all children of the renderBox have also been disposed. Typically, child RenderObjects are disposed by corresponding Elements when they are unmounted. However, child render objects that were manually added do not have corresponding Elements to manage their lifecycle, and need to be manually disposed here.
See also:
- RenderObjectElement.unmount, which invokes this callback before disposing of its render object.
- RenderObject.dispose, which instructs a render object to release any resources it may be holding.
Implementation
final VoidCallback? onUnmount;