onDispose method

void onDispose(
  1. VoidCallback callback
)

Runs the initially registered callback when this widget is removed.

Implementation

void onDispose(VoidCallback callback) {
  stateOf<VoidCallback>(
    () => callback,
    key: const ValueKey(#onDispose),
    mode: .read,
    onDispose: (callback) => callback(),
  );
}