ConnectFluxAdapterStore<S extends Store> constructor
ConnectFluxAdapterStore<S extends Store> (
- S store,
- dynamic actions, {
- List<
Middleware< ? middleware,S> >
Implementation
ConnectFluxAdapterStore(this.store, dynamic actions,
{List<redux.Middleware<S>>? middleware})
: super((_, __) => store,
middleware: middleware ?? const [],
initialState: store,
distinct: false) {
assert(store is! InfluxStoreMixin,
'Use FluxToReduxAdapterStore when your store implements InfluxStoreMixin');
_storeListener = store.listen((_) {
dispatch(_FluxStoreUpdatedAction());
});
actionsForStore[store] = actions;
// This store is useless once the flux store is disposed, so for convenience,
// we'll tear it down for consumers.
//
// In most cases, though, from a memory management standpoint, tearing this
// store down shouldn't be necessary, since any components subscribed to it
// should have also been unmounted, leaving nothing to retain it.
//
// Use a null-aware to accommodate mock stores in unit tests that return null for `didDispose`.
// ignore: unnecessary_cast
(store.didDispose as Future<Null>?)?.whenComplete(teardown);
}