Skip to main content

avoid-instantiating-in-value-provider

added in: 1.4.0
Pro+

Warns when a Provider.value returns a new instance instead of reusing an existing one.

Example

❌ Bad:

Provider.value(
value: RegularService(), // LINT: Avoid creating a new instance. Try providing an existing one instead.
);

✅ Good:

Provider.value(
value: existingInstance,
);

Additional Resources