BidirectionalHydratedBloc<E extends BlocEvent, S extends HydratedBlocState> class abstract

Takes a Stream of BlocEvents as input and transforms them into a Stream of BlocStates as output.

Inheritance
Mixed-in types

Constructors

BidirectionalHydratedBloc({required BlocStore<S> store, required String persitenceKey, BlocStateBuilder<S>? initialStateBuilder, S? initialState})

Properties

addEvent → dynamic Function(BlocEvent)
Notifies the BloC of a new event which triggers mapEventToState. If dispose has already been called, any calls to dispatchEvent will be ignored and will not result in any state changes.
no setteroverride
blocState ↔ S
The current BloC's state.
getter/setter pairinherited
cancelableOperations List<CancelableOperation>
The list of cancelable operations.
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
eventSubscriptions StreamSubscription<S>
The event subscriptions.
getter/setter pairinherited
externalEventController → PublishSubject<E>
The external event controller which is used to control the event stream.
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
internalEventController → PublishSubject<BlocEvent>
The internal event controller which is used to control the event stream.
finalinherited
isBlocHydrated bool
Indicates if the bloc is hydrated.
getter/setter pairoverride
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
onEvent Stream<E>
Called whenever an event is added to the BloC.
no setterinherited
persitenceKey String
The key used to retrieve the state from the store.
finalgetter/setter pairinherited-setteroverride-getter
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
store BlocStore<S>
The BlocStore used to hydrate the bloc.
finalgetter/setter pairinherited-setteroverride-getter
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 a delay.
inherited
debounceEvent(BlocDebounceEventCallback<E> function, {Duration delay = const Duration(milliseconds: 300)}) BlocDebounceEventCallback<E>
Debounces an event. The function will not be invoked until delay.
inherited
getInitialState() → S
Tries to retreive the initial BloC's state.
inherited
handleInternalError(dynamic error) → void
Handles internal errors.
inherited
hydrate() Future<void>
Hydrates the bloc.
inherited
initState() → S
Optional callback method to initialize the BloC's state.
inherited
mapEventToState(E event) Stream<S>
Must be implemented when a class extends BidirectionalBloc. mapEventToState is called whenever an event is added and will convert that event into a new BloC state. It can yield zero, one or several states for an event.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
performCancellableAsyncOperation<T>(Future<T> opreation) Future<T?>
Performs an asynchronous operation and cancels it if the BloC is closed.
inherited
setState(S nextState) → void
Set the BloC state.
inherited
shouldProcessEventInOrder() bool
Determines whether a bloc ensures all events are processed in the order in which they are received.
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 every duration.
inherited
throttleEvent(BlocThrottleEventCallback<E> function, {Duration duration = const Duration(milliseconds: 300)}) BlocThrottleEventCallback<E>
Throttles an event. The event will be ignored if it is dispatched within the specified duration. The last event will be dispatched after the duration has passed.
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