After building the app ios app using flutter and running it on a device, the flutter code gave an exception on visual studio IDE sometimes and crashed. The exception looks like –
Can anyone help why is this happening or provide a possible solution to this ?
The error is telling you that you are trying to rebuild the widget in the process of building the widget.
To resolve this issue, simply call this line of code in the initState() method to ensure that it will be called once just before the first frame is displayed.
2
Answers
Call your code that calls setState with some delay like the following example.
The error is telling you that you are trying to rebuild the widget in the process of building the widget.
To resolve this issue, simply call this line of code in the initState() method to ensure that it will be called once just before the first frame is displayed.