onDispose abstract method
void
onDispose(
- void cb()
inherited
Adds a listener to perform an operation right before the provider is destroyed.
This includes:
- when the provider will rebuild (such as when using watch or refresh).
- when an
autoDispose
provider is no longer used - when the associated
ProviderContainer
/ProviderScope
is disposed`.
See also:
- Provider.autoDispose, a modifier which tell a provider that it should destroy its state when no longer listened to.
ProviderContainer.dispose
, to destroy all providers associated with aProviderContainer
at once.- onCancel, a life-cycle for when all listeners of a provider are removed.
Implementation
void onDispose(void Function() cb);