Skip to main content

avoid-instantiating-in-value-provider

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

Example

❌ Bad:

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

✅ Good:

Provider.value(
value: existingInstance,
);

Additional Resources