I have a pretty basic usage of ref.listen()
. I want to show a bottomSheet once the value of my provider changes.
ref.listen<MyObject?>(myObjectProvider, (previous, next) {
debugPrint("showBottomSheet: ${previous == next}");
});
The following is printed:
showBottomSheet: false
showBottomSheet: true
showBottomSheet: true
showBottomSheet: true
The initial value is null
that is why we get the first false
.
My understanding is that next
has to be different from previous
for the listener to be called.