What does State mean? What is setState()?

avatar
11    6 months ago

What does State mean? What is setState()?

Answers { 1 }
avatar
6 months ago

In simple terms, “State” is a collection of the variable values of your widget. Anything that can change like a counter count, text, etc. can be part of State. Imagine a counter app, the main dynamic thing is the counter count. When the count changes, the screen needs to be refreshed to display the new value. setState() is essentially a way of telling the app to refresh and rebuild the screen with the new values.