invalidate method

  1. @override
void invalidate(
  1. ProviderOrFamily provider
)
override

Invalidates the state of the provider, destroying the state immediately and causing the provider to rebuild at some point in the future.

As opposed to refresh, the rebuild is not immediate and is instead delayed by an undefined amount of time. Typically, the rebuild happens at the next tick of the event loop. But if a provider is not listened to, the rebuild may be delayed until the provider is listened to again.

Calling invalidate multiple times will cause a single recomputation of the state.

If used on a provider which is not initialized or disposed, this method will have no effect.

Implementation

@override
void invalidate(ProviderOrFamily provider) {
  assert(_debugAssertCanDependOn(provider), '');
  _container.invalidate(provider);
}