UnidirectionalBloc<S extends BlocState> class
abstract
A UnidirectionalBloc is a subset of Bloc which has no notion of events and relies on methods to emit new states.
- Inheritance
- Implementers
Constructors
-
UnidirectionalBloc({S? initialState, BlocStateBuilder<
S> ? initialStateBuilder})
Properties
- blocState ↔ S
-
The current BloC's state.
getter/setter pairinherited
- canInitialize → bool
-
Whether the BloC can be initialized.
no setterinherited
- closed ↔ bool
-
Whether the BloC is closed.
getter/setter pairinherited
- currentState → S
-
The current BloC's state.
no setterinherited
- dispatchState → dynamic Function(S)
-
Notifies the BloC of a new state which triggers
onData
.no setterinherited -
errorController
→ PublishSubject<
BlocError> -
The error controller.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- initialState → S?
-
The initial state of the BloC.
finalinherited
-
initialStateBuilder
→ BlocStateBuilder<
S> ? -
The initial state BloC builder.
finalinherited
- isClosed → bool
-
Whether the BloC is closed for dispatching more events.
no setterinherited
- isInitialized ↔ bool
-
Whether the BloC is initializing.
getter/setter pairinherited
- isInitializing ↔ bool
-
Whether the BloC is initializing.
getter/setter pairinherited
-
onData
→ Stream<
S> -
Called whenever the BloC's state is updated.
no setterinherited
-
onError
→ Stream<
BlocError> -
Called whenever the BloC's state is updated.
no setterinherited
-
publishers
→ List<
PublishSubject> -
The list of publishers.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
stateController
→ BehaviorSubject<
S> -
The state controller.
finalinherited
- subxList → SubxList
-
finalinherited
- subxMap → SubxMap
-
finalinherited
Methods
-
canClose(
) → bool -
Whether the BloC can be closed.
Override this method to prevent the BloC from closing.
inherited
-
close(
) → void -
Closes the BloC.
This method should be called when the BloC is no longer needed.
inherited
-
debounce(
BlocDebounceCallback< BlocEvent> function, {Duration delay = const Duration(milliseconds: 300)}) → BlocDebounceCallback<BlocEvent> -
Creates a debounced function that only invokes
function
after adelay
.inherited -
getInitialState(
) → S -
Tries to retreive the initial BloC's state.
inherited
-
initState(
) → S -
Optional callback method to initialize the BloC's state.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setState(
S nextState) → void -
Set the BloC state.
inherited
-
throttle(
BlocThrottleCallback< BlocEvent> function, {Duration duration = const Duration(milliseconds: 300)}) → BlocThrottleCallback<BlocEvent> -
Creates a throttled function that only invokes
function
at most once per everyduration
.inherited -
toString(
) → String -
A string representation of this object.
inherited
-
transformError(
dynamic error, StackTrace stackTrace) → BlocError? -
Transforms the error before it is emitted.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited