The thing I am doing is calling setState() method and then updating the state after a delay of 5 seconds. Even then, i am seeing the State getting updated.
setState(() {
print("callback");
});
sleep(const Duration(seconds: 5));
_randomNumber = Random().nextInt(100);
print("Number : $_randomNumber");
As you can see after the delay, _randomNumber is changing & I have set this _randomNumber value to a Text Widget. After 10 seconds, text is getting updated with the new _randomNumber. Then what is the use of calling setState(() {}) & wrapping the state changes only inside setState() ?