Implementing setState causes Infinite Loop Flutter

Posted by Editorial Staff | Updated on

Implementing setState causes Infinite Loop Flutter. getClassesToDisplay() calls setState() with a delay (then) which causes build() to be run, which calls getClassesToDisplay() – simple endless loop.

Remove getClassesToDisplay() from build() and call it from initState() instead.


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.

Related Questions & Answers