在 Flutter redux 中比较旧视图模型和当前视图模型
Compare old view model and current view model in Flutter redux
在Flutter-redux中,我们可以使用onDidChange和onWillChange来检测store state的变化。但是有没有办法检测特定属性的变化?
我可以做类似
的事情吗
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: ),
在Flutter-redux中,我们可以使用onDidChange和onWillChange来检测store state的变化。但是有没有办法检测特定属性的变化?
我可以做类似
的事情吗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: ),