avoid-unnecessary-parentheses
Suggests removing unnecessary parentheses.
Example
❌ Bad:
void fn(List<int> input, List<int>? another) async {
// LINT: Unnecessary parentheses. Try removing them.
final _ = [...(input)];
// LINT: Unnecessary parentheses. Try removing them.
final _ = (input.isEmpty) ? true : false;
final toolPath = another != null
// LINT: Unnecessary parentheses. Try removing them.
? input.isEmpty ? input : (await input)
// LINT: Unnecessary parentheses. Try removing them.
: (input);
}
bool f(int a) {
return (a.isEven); // LINT: Unnecessary parentheses. Try removing them.
}
✅ Good:
void fn(List<int> input, List<int>? another) async {
final _ = [...input];
final _ = input.isEmpty ? true : false;
final toolPath = another != null
? input.isEmpty ? input : await input
: input;
}
bool f(int a) {
return a.isEven;
}