triple_pattern icon indicating copy to clipboard operation
triple_pattern copied to clipboard

Results accumulating on store.observer call

Open LuizFelipeMisseno opened this issue 3 years ago • 2 comments

Hello, thank you for the package. I have a doubt about behavior of the store.observer, why is it accumulating the results? The first time I call the method, it returns nothing, the second time it returns once, the third time it returns twice and so on.

I may be missunderstanding the behavior of the method, but I expected it to only return the result once, because if I call a showDialog for example, I don't want it to be called 2, 3, 4.. times, just once.

image

This screenshot is the result, as you can see the number of results increases as I call the function.

LuizFelipeMisseno avatar Nov 28 '22 14:11 LuizFelipeMisseno

Could you please provide part of the code or any other insight about your implementation?

tauamendonca avatar Dec 30 '22 00:12 tauamendonca

Disposer? disposer;

@override
void initState() {
    super.initState();
    disposer = controller.observer(
       onState: (state) => onState(state)
  );
}

@override
 void dispose() {
    disposer!.call();
    super.dispose();
 }

rodrigodittrich avatar Jun 08 '24 11:06 rodrigodittrich