Skip to main content


added in: 1.7.0
preset: recommended

Warns when an Image widget does not have a semanticLabel.

⚙️ Config

Set allow-empty (default is true) to configure whether an empty string value is allowed to be used as label.

Set ignore-svg (default is true) to configure whether the rule should check SvgPicture.

- avoid-missing-image-alt:
allow-empty: true


❌ Bad:

void main() {
const Image(key: 'hello'); // LINT
Image.asset(key: 'hello'); // LINT

const FadeInImage(key: 'hello'); // LINT
FadeInImage.assetNetwork(key: 'hello'); // LINT

✅ Good:

void main() {
const Image(key: 'hello', semanticLabel: 'some');
Image.asset(key: 'hello', semanticLabel: 'thing');

const FadeInImage(key: 'hello', imageSemanticLabel: 'some');
FadeInImage.assetNetwork(key: 'hello', imageSemanticLabel: 'thing');