onDidUpdateWidget function

void onDidUpdateWidget(
  1. void callback()
)

Registers a callback to run when the widget is updated with new properties.

This is called whenever the parent widget rebuilds and provides new properties to this widget.

Example:

@override
setup(context, props) {
  onDidUpdateWidget(() {
    print('Widget updated with new props');
  });

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

Implementation

void onDidUpdateWidget(void Function() callback) {
  useHook(_OnDidUpdateWidgetHook(callback));
}