You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I expect ref.watch(provider.future) to trigger the ref.onAddListener. However, it does not appear to be happening. I'm not an expert in Riverpod, so I wasn't sure if watching a future should trigger this, but when debugging I found that listen was still being called?
@override
T watch<T>(ProviderListenable<T> listenable) {
_assertNotOutdated();
assert(!_debugIsRunningSelector, 'Cannot call ref.watch inside a selector');
if (listenable is! ProviderBase<T>) {
final sub = listen<T>( <-- was executed
listenable,
(prev, value) => _markDependencyChanged(),
onError: (err, stack) => _markDependencyChanged(),
onDependencyMayHaveChanged: _markDependencyMayHaveChanged,
);
return sub.read();
}
I added ref.watch(provider) without the future, and immediately the callback is triggered.
To Reproduce
Create a provider that returns a value
Add an onAddListener callback
Call the provider using ref.watch(provider.future)
onAddListener callback is not called
Expected behavior
onAddListener is called
The text was updated successfully, but these errors were encountered:
Describe the bug
I expect ref.watch(provider.future) to trigger the ref.onAddListener. However, it does not appear to be happening. I'm not an expert in Riverpod, so I wasn't sure if watching a future should trigger this, but when debugging I found that listen was still being called?
I added ref.watch(provider) without the future, and immediately the callback is triggered.
To Reproduce
Expected behavior
onAddListener is called
The text was updated successfully, but these errors were encountered: