overrides property

List<Override> overrides
final

Information on how to override a provider/family.

Overrides are created using methods such as Provider.overrideWith/Provider.overrideWithValue.

This can be used for:

  • testing, by mocking a provider.
  • dependency injection, to avoid having to pass a value to many widgets in the widget tree.
  • performance optimization: By using this to inject values to widgets using ref inside of their constructor, widgets may be able to use const constructors, which can improve performance.

Note: Overrides only apply to this ProviderScope and its descendants. Ancestors of this ProviderScope will not be affected by the overrides.

Implementation

final List<Override> overrides;