Skip to content

2022年开发笔记第二期

Pre-release
Pre-release
Compare
Choose a tag to compare
@josercc josercc released this 06 Feb 08:26
7d8577c

Flutter 中 Provider 如何监听 List 的更新

不要直接操作数组,需要先设置新数组

错误操作

list.add("hello");
notifyListeners()
list.add("hello");
list = [...list];
notifyListeners()

正确操作

list = [...list];
list.add("hello");
notifyListeners();