BlocImpl class

The implementation for Bloc. Extend this class to create a basic Bloc.

An interface class that extends or implements Bloc should be created for every created subclass of BlocImpl. The interface is not required but prevents access from internal variables. See section at the bottom of BlocImpl class documentation for reasoning.

Impls classes are used due to Dart's lack of protected variable. Any variables that are declared as public but aren't intended for use other than in subclasses are marked with the protected annotation. They can still be access but the analyzer will show warnings.

Implemented types
Implementers

Constructors

BlocImpl(String key, Observable<Action> actionObservable)

Properties

actionObservable Observable<Action>
The Observable carrying Actions from the Dispatcher.
final
closed bool
True if this Bloc has been closed or actionObservable has finished.
read-only, override
fieldIDs Iterable<FieldID>
FieldIDs for all registered Fields.
read-only, override
fieldMap Map<FieldID, Field>
A map of all FieldIDs to Fields.
@protected, final
hashCode int
The hash code for this object. [...]
read-only, inherited
isInitialized bool
Whether or not init() has been called. [...]
read-only
key String
A unique identifer for this Bloc.
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

addField(Field field) → void
Adds field to fieldMap. [...]
checkClosed() → void
If closed is equal to true a StateError is thrown.
dispose() → void
Perform clean up operations including calling dispose method of all registered Fields. [...]
@mustCallSuper, override
init(Action first) → void
This method is called when the first Action is received from actionObservable. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
removeField(Field field) → void
Removes the Field from fieldMap with the same FieldID as the field argument if it is present.
toString() String
A string representation of this object. [...]
inherited

Operators

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