Skip to main content

prefer-private-extension-type-field

added in: 1.15.0
🛠
Dart 3.3+

Warns when an extension type has a public representation field.

Public representation fields can be accessed directly, which may lead to potential mistakes. Consider exposing only the required properties or methods.

Example

❌ Bad:

extension type ET(String value) {} // LINT

✅ Good:

extension type ET(String _value) {}