'Does setState() inherently affect the application performance?
I read that setState affect application performance because it rebuilds the widget tree.
Calling
setStatenotifies the framework that the internal state of this object has changed in a way that might impact the user interface in this subtree, which causes the framework to schedule a build for this State object.
Is this an actual concern for application performance?
Solution 1:[1]
Yeah, it may but only if you are calling the function too many times unnecessarily.
What's the best practice?
Try calling it at the end of functionality or only when you need to update the widget, you can also create multiple subclasses ( stateful widget), so if you want some changes in a particular area only, then only that widget will get updated not the entire screen.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Vicky Salunkhe |
