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<int> {
  Counter(0): super(0);
  ...  @override  Triple<int> middleware(triple){    if(triple.event == TripleEvent.state){      return triple.copyWith(state + 2);    }
    return triple;  }
}