onUnmount property

VoidCallback? onUnmount
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:

Implementation

final VoidCallback? onUnmount;