Flutter run method on Widget build complete. If you want to be certain that also the last frame of your layout was drawned you can write for example:
1 2 3 4 5 6 7 8 | import 'package:flutter/scheduler.dart'; void initState() { super.initState(); if (SchedulerBinding.instance.schedulerPhase == SchedulerPhase.persistentCallbacks) { SchedulerBinding.instance.addPostFrameCallback((_) => yourFunction(context)); } } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.