onMount method

void onMount()
inherited

Called after the component has successfully run onLoad and before the component is added to its new parent.

Whenever onMount returns something, the parent will wait for the Future to be resolved before adding it. If null is returned, the class is added right away.

This can be overwritten to add custom logic to the component's mounting.

Example:

@override
void onMount() {
  position = parent!.size / 2;
}

Implementation

void onMount() {}