If you want to do this only once, then do it because The framework will call initState()
method exactly once for each State object it creates.
@override
void initState() {
super.initState();
WidgetsBinding.instance
.addPostFrameCallback((_) => executeAfterBuildComplete(context));
}
If you want to do this again and again like on back or navigate to a next screen and etc..., then do it because didChangeDependencies()
Called when a dependency of this State object changes.
For example, if the previous call to build
referenced an InheritedWidget
that later changed, the framework would call this method to notify this object about the change.
This method is also called immediately after initState
. It is safe to call BuildContext.dependOnInheritedWidgetOfExactType
from this method.
@override
void didChangeDependencies() {
super.didChangeDependencies();
WidgetsBinding.instance
.addPostFrameCallback((_) => executeAfterBuildComplete(context));
}
This is the your Callback function
executeAfterBuildComplete([BuildContext context]){
print("Build Process Complete");
}