Bloc class abstract
BLoC(Business Logic Component) base class.
When defining some BLoC, it should implements this.
Example
class CounterBloc implements Bloc {
final _countController = BehaviorSubject<int>(seedValue: 0);
final _incrementController = PublishSubject<void>();
CounterBloc() {
_incrementController
.scan<int>((sum, _v, _i) => sum + 1, 0)
.pipe(_countController);
}
ValueStream<int> get count => _countController;
Sink<void> get increment => _incrementController.sink;
@override
void dispose() async {
await _incrementController.close();
await _countController.close();
}
}
Constructors
- Bloc()
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dispose(
) → void -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited