onDeactivated function

void onDeactivated(
  1. void callback()
)

Registers a callback to run when the widget is deactivated.

This is called when the widget is removed from the tree but may be reinserted later.

Example:

@override
setup(context, props) {
  onDeactivated(() {
    print('Widget deactivated');
  });

  return () => Text('Hello');
}

Implementation

void onDeactivated(void Function() callback) {
  useHook(_OnDeactivatedHook(callback));
}