The problem is, I need to call method after widget is built, otherwise I'm getting an error. So I want to know is there a way to check whether widget is built, maybe a listener?
All widgets have a bool this.mounted property. It turns true when the buildContext is assigned.
Tip: Its a good practice to set the state of any widget only after the widget is built and I usually use this bool to set states once it is true. It is an error to call setState when a widget is unmounted or before it is mounted.
In your case, I feel you need the same thing, run your method if this.mounted == true.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With