flutter setstate
时间: 2023-09-02 20:13:50 浏览: 165
在Flutter中,setState()方法是用于更新widget状态的。当widget的状态发生改变时,Flutter会创建一个新的widget,并将其与之前的widget进行比较,然后进行重建。通过使用setState()方法,我们可以告诉Flutter重新构建当前widget的子树。 这个方法非常简单,它只是将一个回调函数放入队列中,在下一帧中调用它,从而重新构建widget子树。这个方法是实现Flutter中高效UI更新的重要手段。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [flutter的setState详细分析以及性能优化](https://blog.csdn.net/qq_28563283/article/details/130215555)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *3* [flutter局部刷新的实现示例](https://download.csdn.net/download/weixin_38673548/14878234)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文