Skip to main content

Middleware

We can add interceptors and modify the triple when the setLoading, setError or update action is executed.

class Counter extends StreamStore<Exception, int> {
  Counter(0): super(0);
  ...  @override  Triple<Exception, int> middleware(triple){    if(triple.event == TripleEvent.state){      return triple.copyWith(state + 2);    }
    return triple;  }
}