onMounted function

void onMounted(
  1. void callback()
)

Registers a callback to run when the widget is mounted.

This is called after the widget is fully initialized and added to the tree.

Example:

@override
setup(context, props) {
  onMounted(() {
    print('Widget mounted!');
  });

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

Implementation

void onMounted(void Function() callback) {
  useHook(_OnMountedHook(callback));
}