BlocOverrides class abstract

This class facilitates overriding BlocObserver and EventTransformer. It should be extended by another class in client code with overrides that construct a custom implementation. The implementation in this class defaults to the base blocObserver and eventTransformer implementation. For example:

class MyBlocObserver extends BlocObserver {
  ...
  // A custom BlocObserver implementation.
  ...
}

void main() {
  BlocOverrides.runZoned(() {
    ...
    // Bloc instances will use MyBlocObserver instead of the default BlocObserver.
    ...
  }, blocObserver: MyBlocObserver());
}

Constructors

BlocOverrides()

Properties

blocObserver BlocObserver
The BlocObserver that will be used within the current Zone.
no setter
eventTransformer → EventTransformer
The EventTransformer that will be used within the current Zone.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

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

Static Properties

current BlocOverrides?
Returns the current BlocOverrides instance.
no setter

Static Methods

runZoned<R>(R body(), {BlocObserver? blocObserver, EventTransformer? eventTransformer}) → R
Runs body in a fresh Zone using the provided overrides.