Skip to main content

avoid-unnecessary-gesture-detector

added in: 1.15.0

Warns when a GestureDetector widget has no event handlers.

Example

❌ Bad:

// LINT
GestureDetector(
child: Widget(),
);

✅ Good:

GestureDetector(
onTapDown: () {
...
},
child: Widget(),
);