perform action when build is done flutter

196

WidgetsBinding.instance.addPostFrameCallback((_) {
  // executes after build
})
@override
Widget build(BuildContext context) {
  WidgetsBinding.instance.addPostFrameCallback((_) => afterBuild);
  return Container(); // widget tree
}

void afterBuild() {
  // executes after build is done
}

Comments

Submit
0 Comments