The fix should be obvious once you know which parent widget is missing.

‘setState called during build’

The build method in your Flutter code is not a good place to call setState 
either directly or indirectly.

What does the error look like?

When the error occurs, the following message gets displayed in the console:

How might you run into the error?

In general, this error occurs when the setState method is called within the
build method.

A common scenario where this error occurs is when attempting to trigger a Dialog
from within the build method. This is often motivated by the need to
immediately show information to the user, but setState should never be called
from a build method.

Below is a snippet that seems to be a common culprit of this error: