InfluxStoreMixin<S> mixin

A mixin that adds the fields necessary to make a Flux store compatible with the Influx architecture.

The mixin enforces the pattern necessary for an Influx architecture by adding the influxReducer and triggerReduxUpdateFromFlux, while also exposing the state field that is backed by a Redux state class. To make the store compatible with Redux, the Flux store using the InfluxStoreMixin should be wrapped with a FluxToReduxAdapterStore.

Example:

import 'package:w_flux/w_flux_server.dart' as flux;

class ExampleFluxStore extends flux.Store with InfluxStoreMixin<ReduxState> {
  FluxActions _actions

  @override
  get reduxReducer => exampleReducer;

  String get valueFromState => state.valueFromState;

  ExampleFluxStore(this._actions) {
    state = ReduxState('default state');

    triggerOnActionV2(_actions.fluxAction,
        () => this.influxReducer(ReduxAction('New Value')));
  }

}

class ReduxAction {
  String value;

  ReduxAction(this.value);
}

class ReduxState {
  String valueFromState;

  ReduxState(this.valueFromState);
}

ReduxState exampleReducer(ReduxState oldState, Object action) {
  if (action is ReduxAction) return ReduxState(action.value);

  return oldState;
}
Available extensions

Properties

didDispose Future<Null>
A Future that will complete when this object has been disposed.
no setterinherited
disposableTypeName String
A type name, similar to runtimeType but intended to work with minified code.
no setterinherited
disposalTreeSize int
The total size of the disposal tree rooted at the current Disposable instance.
no setterinherited
first Future<Store>
The first element of this stream.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
isBroadcast bool
Whether this stream is a broadcast stream.
no setterinherited
isDisposed bool
Whether this object has been disposed.
no setterinherited
isEmpty Future<bool>
Whether this stream contains any elements.
no setterinherited
isLeakFlagSet bool
Whether the leak flag for this object has been set.
no setterinherited
isOrWillBeDisposed bool
Whether the disposal of this object has been requested, is in progress, or is complete.
no setterinherited
last Future<Store>
The last element of this stream.
no setterinherited
length Future<int>
The number of elements in this stream.
no setterinherited
reduxReducer → Reducer<S>
A traditional Redux reducer function that should return a new instance of the corresponding state class.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
single Future<Store>
The single element of this stream.
no setterinherited
state ↔ S
An instance of the Redux state model that the Flux store is migrating to.
getter/setter pair
stream Stream<Store>
The stream underlying trigger events and listen.
no setterinherited

Methods

any(bool test(Store element)) Future<bool>
Checks whether test accepts any element provided by this stream.
inherited
asBroadcastStream({void onListen(StreamSubscription<Store> subscription)?, void onCancel(StreamSubscription<Store> subscription)?}) Stream<Store>
Returns a multi-subscription stream that produces the same events as this.
inherited
asyncExpand<E>(Stream<E>? convert(Store event)) Stream<E>
Transforms each element into a sequence of asynchronous events.
inherited
asyncMap<E>(FutureOr<E> convert(Store event)) Stream<E>
Creates a new stream with each data event of this stream asynchronously mapped to a new event.
inherited
awaitBeforeDispose<T>(Future<T> future) Future<T>
Add future to a list of futures that will be awaited before the object is disposed.
inherited
cast<R>() Stream<R>
Adapt this stream to be a Stream<R>.
inherited
contains(Object? needle) Future<bool>
Returns whether needle occurs in the elements provided by this stream.
inherited
dispose() Future<Null>
Dispose of the object, cleaning up to prevent memory leaks.
inherited
distinct([bool equals(Store previous, Store next)?]) Stream<Store>
Skips data events if they are equal to the previous data event.
inherited
drain<E>([E? futureValue]) Future<E>
Discards all data on this stream, but signals when it is done or an error occurred.
inherited
elementAt(int index) Future<Store>
Returns the value of the indexth data event of this stream.
inherited
every(bool test(Store element)) Future<bool>
Checks whether test accepts all elements provided by this stream.
inherited
expand<S>(Iterable<S> convert(Store element)) Stream<S>
Transforms each element of this stream into a sequence of elements.
inherited
firstWhere(bool test(Store element), {Store orElse()?}) Future<Store>
Finds the first element of this stream matching test.
inherited
flagLeak([String? description]) → void
Flag the object as having been disposed in a way that allows easier profiling.
inherited
fold<S>(S initialValue, S combine(S previous, Store element)) Future<S>
Combines a sequence of values by repeatedly applying combine.
inherited
forEach(void action(Store element)) Future<void>
Executes action on each element of this stream.
inherited
getManagedDelayedFuture<T>(Duration duration, T callback()) Future<T>
Creates a Future that will complete, with the value returned by callback, after the given amount of time has elapsed.
inherited
getManagedDisposer(Disposer disposer) → ManagedDisposer
Automatically handle arbitrary disposals using a callback.
inherited
getManagedPeriodicTimer(Duration duration, void callback(Timer timer)) Timer
Creates a periodic Timer that will be cancelled if active upon disposal.
inherited
getManagedTimer(Duration duration, void callback()) Timer
Creates a Timer instance that will be cancelled if active upon disposal.
inherited
handleError(Function onError, {bool test(dynamic error)?}) Stream<Store>
Creates a wrapper Stream that intercepts some errors from this stream.
inherited
influxReducer(dynamic action) → void
A wrapper around a pure Redux reducer that keeps the Flux UI up to date with store changes.
join([String separator = ""]) Future<String>
Combines the string representation of elements into a single string.
inherited
lastWhere(bool test(Store element), {Store orElse()?}) Future<Store>
Finds the last element in this stream matching test.
inherited
listen(StoreHandler? onData, {Function? onError, void onDone()?, bool? cancelOnError}) StreamSubscription<Store>
Adds a subscription to this Store.
inherited
listenToStream<T>(Stream<T> stream, void onData(T event), {Function? onError, void onDone()?, bool? cancelOnError}) StreamSubscription<T>
Returns a StreamSubscription which handles events from the stream using the provided onData, onError and onDone handlers.
inherited
manageActionSubscription(ActionSubscription subscription) → void
Registers an ActionSubscription to be canceled when the store is disposed.
inherited
manageAndReturnTypedDisposable<T extends Disposable>(T disposable) → T
Automatically dispose another object when this object is disposed.
inherited
manageCompleter<T>(Completer<T> completer) Completer<T>
Ensure that a completer is completed when the object is disposed.
inherited
manageDisposable(Disposable disposable) → void
inherited
manageStreamController(StreamController controller) → void
Automatically cancel a stream controller when this object is disposed.
inherited
map<S>(S convert(Store event)) Stream<S>
Transforms each element of this stream into a new stream event.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onDispose() Future<Null>
Callback to allow arbitrary cleanup on dispose.
inherited
onWillDispose() Future<Null>
Callback to allow arbitrary cleanup as soon as disposal is requested (i.e. dispose is called) but prior to disposal actually starting.
inherited
pipe(StreamConsumer<Store> streamConsumer) Future
Pipes the events of this stream into streamConsumer.
inherited
reduce(Store combine(Store previous, Store element)) Future<Store>
Combines a sequence of values by repeatedly applying combine.
inherited
singleWhere(bool test(Store element), {Store orElse()?}) Future<Store>
Finds the single element in this stream matching test.
inherited
skip(int count) Stream<Store>
Skips the first count data events from this stream.
inherited
skipWhile(bool test(Store element)) Stream<Store>
Skip data events from this stream while they are matched by test.
inherited
take(int count) Stream<Store>
Provides at most the first count data events of this stream.
inherited
takeWhile(bool test(Store element)) Stream<Store>
Forwards data events while test is successful.
inherited
timeout(Duration timeLimit, {void onTimeout(EventSink<Store> sink)?}) Stream<Store>
Creates a new stream with the same events as this stream.
inherited
toList() Future<List<Store>>
Collects all elements of this stream in a List.
inherited
toSet() Future<Set<Store>>
Collects the data of this stream in a Set.
inherited
toString() String
A string representation of this object.
inherited
transform<S>(StreamTransformer<Store, S> streamTransformer) Stream<S>
Applies streamTransformer to this stream.
inherited
trigger() → void
Trigger a "data updated" event. All registered listeners of this Store will receive the event, at which point they can use the latest data from this Store as necessary.
inherited
triggerOnAction(ActionV2 action, [void onAction(dynamic payload)?]) → dynamic
A convenience method for listening to an action and triggering automatically once the callback for said action has completed.
inherited
triggerOnActionV2<T>(ActionV2<T> action, [FutureOr onAction(T payload)?]) → void
A convenience method for listening to an action and triggering automatically once the callback for said action has completed.
inherited
where(bool test(Store event)) Stream<Store>
Creates a new stream from this stream that discards some elements.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited