flutter how to run some code once the component is displayed in the screen code example
Example: flutter on build complete
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) => yourFunction(context));
}