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