BlocOverrides class Null safety

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. [...]
read-only
eventTransformer EventTransformer
The EventTransformer that will be used within the current Zone. [...]
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent 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. [...]
read-only

Static Methods

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