首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >颤振还原中旧视图模型与当前视图模型的比较

颤振还原中旧视图模型与当前视图模型的比较
EN

Stack Overflow用户
提问于 2019-06-03 06:22:01
回答 1查看 760关注 0票数 0

在Flutter-redux中,我们可以使用onDidChange和onWillChange来检测存储状态的变化。但是,有没有一种方法可以检测特定属性的更改?

我可以做像这样的事情吗?

if(oldViewModel.changedProperty != viewModel.changedProperty)

在react-redux中,可以检查prevProps和currProps的差异,并根据差异执行操作。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-06-11 17:13:58

代码语言:javascript
复制
// As a performance optimization, the Widget can be rebuilt only when the
// [ViewModel] changes. In order for this to work correctly, you must
// implement [==] and [hashCode] for the [ViewModel], and set the [distinct]
// option to true when creating your StoreConnector.

StoreConnector<AppState, AppState>(
              distinct: true,
              converter: (store) => store.state,
              builder: ),
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56419359

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档