FeatureObserverWrapper<State, Msg, Effect> class final

A wrapper for adding observation capabilities to a Feature.

FeatureObserverWrapper enhances a feature by integrating a FeatureObserver, allowing you to monitor lifecycle events, state changes, messages, and effects.

Key Features:

  • Notifies the observer about lifecycle events (onCreate, onInit, onDispose).
  • Observes and reports state updates, messages, and effects.

Example:

final observedFeature = myFeature.observe(MyObserver());
Inheritance
Available extensions
Annotations
  • @experimental

Constructors

FeatureObserverWrapper({required Feature<State, Msg, Effect> feature, required FeatureObserver<State, Msg, Effect> observer})
Creates a new FeatureObserverWrapper.

Properties

disposableEffects List<Effect>
Delegates to the disposableEffects of the wrapped feature.
no setterinherited
effects Stream<Effect>
Delegates effect stream access to the wrapped feature.
no setterinherited
feature Feature<State, Msg, Effect>
The wrapped Feature instance.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
initialEffects List<Effect>
Delegates to the initialEffects of the wrapped feature.
no setterinherited
observer FeatureObserver<State, Msg, Effect>
The observer monitoring the feature.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state → State
Retrieves the current state from the wrapped feature.
no setterinherited
stateStream Stream<State>
Delegates state stream access to the wrapped feature.
no setterinherited

Methods

accept(Msg message) → void
Notifies the observer when a message is accepted.
override
dispose() Future<void>
Disposes the feature and cleans up subscriptions.
override
init() FutureOr<void>
Initializes the feature and starts observing state and effect streams.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
observe(FeatureObserver<S, M, E> observer) Feature<S, M, E>

Available on Feature<S, M, E>, provided by the FeatureObserverWrapperHelper extension

Wraps the feature with the specified observer.
toString() String
A string representation of this object.
inherited
wrapEffects<E extends Effect>(EffectHandler<E, Msg> handler) Feature<State, Msg, Effect>

Available on Feature<State, Msg, Effect>, provided by the EffectHandlerWrapperUtils extension

Wraps the feature with an EffectHandler for effects of type E.

Operators

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