在 Flutter redux 中比较旧视图模型和当前视图模型



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

我可以做类似的事情吗

if(oldViewModel.changedProperty != viewModel.changedProperty)

在 react-redux 中,可以检查 prevProps 和 currProps 是否存在差异并基于此执行操作。

// 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: ),

最新更新