FeatureEffectWrapper<State, Msg, Effect, E extends Effect> class
final
A wrapper around a Feature that intercepts specific types of effects.
FeatureEffectWrapper allows you to handle a subset of effects (of type E
)
with a dedicated EffectHandler. This enables fine-grained control over the
processing of effects emitted by the wrapped feature.
Key Features:
- Listens for effects of type
E
and processes them using the provided handler. - Handles effects from the initialEffects, the disposableEffects and the effects stream.
- Cleans up resources during disposal, including canceling subscriptions and disposing the handler if it implements Disposable.
Example:
final loggingWrapper = myFeature.wrap<LogEffect>(
(effect, emit) => print('Log: $effect'),
);
- Inheritance
-
- Object
- ProxyFeature<
State, Msg, Effect> - FeatureEffectWrapper
- Available extensions
- Annotations
-
- @experimental
Constructors
-
FeatureEffectWrapper({required Feature<
State, Msg, Effect> feature, required EffectHandler<E, Msg> handler}) - Creates a new FeatureEffectWrapper.
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
-
handler
→ EffectHandler<
E, Msg> -
The EffectHandler responsible for processing effects of type
E
.final - hashCode → int
-
The hash code for this object.
no setterinherited
-
initialEffects
→ List<
Effect> -
Delegates to the initialEffects of the wrapped feature.
no setterinherited
- 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 -
Delegates message handling to the wrapped feature.
inherited
-
dispose(
) → Future< void> -
Disposes of resources managed by the wrapper.
override
-
init(
) → FutureOr< void> -
Initializes the wrapper by:
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<
Wraps the feature with the specifiedS, M, E> , provided by the FeatureObserverWrapperHelper extensionobserver
. -
toString(
) → String -
A string representation of this object.
inherited
-
wrapEffects<
E extends Effect> (EffectHandler< E, Msg> handler) → Feature<State, Msg, Effect> -
Available on Feature<
Wraps the feature with an EffectHandler for effects of typeState, Msg, Effect> , provided by the EffectHandlerWrapperUtils extensionE
.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited