FastStoreBloc class

The FastStoreBloc extends BidirectionalBloc, which provides the necessary functionality to handle events and state changes in the store.

Inheritance

Constructors

FastStoreBloc.new()
A factory constructor that returns an instance of FastStoreBloc. It ensures that only one instance is created.
factory

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 setterinherited
analyticsEventController → BehaviorSubject<BlocAnalyticsEvent>
finalinherited
blocState FastStoreBlocState
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 FastStoreBlocState
The current BloC's state.
no setterinherited
dispatchState → dynamic Function(FastStoreBlocState)
Notifies the BloC of a new state which triggers onData.
no setterinherited
enableForceBuildEvents bool
Enable force build events, if you want to force the rendering of the bloc builder. Indicates if the event-state history should be saved.
finalinherited
errorController → PublishSubject<BlocError>
The error controller.
finalinherited
eventStateHistory Map<FastStoreBlocEvent, List<String>>
The history map that stores the event-state history.
finalinherited
eventStateHistorySize int
The maximum size of the history. Set it to null to disable the limit.
finalinherited
eventSubscriptions StreamSubscription<FastStoreBlocState>
The event subscriptions.
getter/setter pairinherited
externalEventController → PublishSubject<FastStoreBlocEvent>
The external event controller which is used to control the event stream.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
initialState FastStoreBlocState?
The initial state of the BloC.
finalinherited
initialStateBuilder → BlocStateBuilder<FastStoreBlocState>?
The initial state BloC builder.
finalinherited
internalEventController → PublishSubject<BlocEvent>
The internal event controller which is used to control the event stream.
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
onAnalyticsEvents Stream<BlocAnalyticsEvent>
no setterinherited
onData Stream<FastStoreBlocState>
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<FastStoreBlocEvent>
Called whenever an event is added to the BloC.
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<FastStoreBlocState>
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.
override
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(BlocEventCallback<FastStoreBlocEvent> function, {Duration delay = const Duration(milliseconds: 300)}) → BlocEventCallback<FastStoreBlocEvent>
Debounces an event. The function will not be invoked until delay.
inherited
getEventForState(FastStoreBlocState state) FastStoreBlocEvent?
Returns the event related to the given state.
inherited
getInitialState() FastStoreBlocState
Tries to retreive the initial BloC's state.
inherited
getProductDetails(String productId) Future<ProductDetails?>
handleError(dynamic error) → void
handleInitEvent(FastStoreBlocPayload payload) Stream<FastStoreBlocState>
Handles the FastStoreBlocEventType.init event to initialize the store.
handleInitializedEvent() Stream<FastStoreBlocState>
Handles the FastStoreBlocEventType.initialized event when the store has been successfully initialized.
handleInternalError(dynamic error, StackTrace stackTrace) → void
Handles internal errors.
inherited
handleLoadProductsEvent() Stream<FastStoreBlocState>
Handles the FastStoreBlocEventType.loadProducts event to load products available for purchase in the store.
handleLoadProductsFailedEvent(dynamic error) Stream<FastStoreBlocState>
Handles the FastStoreBlocEventType.loadProductsFailed event when loading products from the store has failed.
handleProductPurchasedEvent(FastStoreBlocPayload payload) Stream<FastStoreBlocState>
Handles the FastStoreBlocEventType.productPurchased event when a product has been successfully purchased.
handleProductsLoadedEvent(FastStoreBlocPayload payload) Stream<FastStoreBlocState>
Handles the FastStoreBlocEventType.productsLoaded event when products have been successfully loaded from the store.
handlePurchaseProductCanceledEvent() Stream<FastStoreBlocState>
Handles the FastStoreBlocEventType.purchaseProductCanceled event when a product purchase has been canceled.
handlePurchaseProductEvent(FastStoreBlocPayload payload) Stream<FastStoreBlocState>
Handles the FastStoreBlocEventType.purchaseProduct event to initiate a purchase of a specific product.
handlePurchaseProductFailedEvent(dynamic error) Stream<FastStoreBlocState>
Handles the FastStoreBlocEventType.purchaseProductFailed event when purchasing a product has failed.
handlePurchasesRestoredEvent(FastStoreBlocPayload payload) Stream<FastStoreBlocState>
Handles the FastStoreBlocEventType.purchaseRestored event when a purchase has been successfully restored.
handleRestorePurchasesEvent() Stream<FastStoreBlocState>
Handles the FastStoreBlocEventType.restorePurchases event to restore purchases from the store.
handleRestorePurchasesFailedEvent(dynamic error) Stream<FastStoreBlocState>
Handles the FastStoreBlocEventType.restorePurchasesFailed event when restoring purchases has failed.
initState() FastStoreBlocState
Optional callback method to initialize the BloC's state.
inherited
mapEventToState(FastStoreBlocEvent event) Stream<FastStoreBlocState>
Maps incoming FastStoreBlocEvents to the appropriate state changes based on the event type.
override
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
resetBloc() → void
inherited
sampleEvent(BlocEventCallback<FastStoreBlocEvent> function, {Duration delay = const Duration(milliseconds: 300)}) → BlocEventCallback<FastStoreBlocEvent>
inherited
setState(FastStoreBlocState 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(BlocEventCallback<FastStoreBlocEvent> function, {Duration duration = const Duration(milliseconds: 300)}) → BlocEventCallback<FastStoreBlocEvent>
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
updateEventStateHistory(FastStoreBlocEvent event, FastStoreBlocState nextState) → void
Updates the event-state history. The event-state history is used to determine the event related to a given state.
inherited

Operators

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

Static Properties

hasBeenInstantiated bool
Keeps track if a singleton instance has been created.
no setter
instance FastStoreBloc
no setter

Static Methods

reset() → void

Constants

debugLabel → const String