ConnectFluxAdapterStore<S extends Store> constructor

ConnectFluxAdapterStore<S extends Store>(
  1. S store,
  2. dynamic actions, {
  3. List<Middleware<S>>? middleware,
})

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);
}