boolean_prefixes
Severity | Quick Fix | Options |
---|---|---|
Info | ❌ | ✅ |
Details
DO prefix boolean variables, functions and getters with specific verbs.
see: effective-dart
Default valid prefixes:
- is
- are
- was
- were
- has
- have
- had
- can
- should
- will
- do
- does
- did
Bad
class Point {
final double x;
final double y;
const Point(this.x, this.y);
bool get origin => x == 0 && y == 0;
bool samePoint(Point other) => x == other.x && y == other.y;
}
Good
class Point {
final double x;
final double y;
const Point(this.x, this.y);
bool get isOrigin => x == 0 && y == 0;
bool isSamePoint(Point other) => x == other.x && y == other.y;
}