Group: style
Maturity: stable
Dart SDK: >= 2.0.0 • (Linter v0.1.44)
Since info is static, may be staleAVOID using parentheses when not needed.
BAD:
a = (b);
GOOD:
a = b;
Parentheses are considered unnecessary if they do not change the meaning of the code and they do not improve the readability of the code. The goal is not to force all developers to maintain the expression precedence table in their heads, which is why the second condition is included. Examples of this condition include:
a.b = (c..d)
.!await foo
which is valid and equivalent to
!(await foo)
.(a && b) || c && d
.To enable the unnecessary_parenthesis
lint,
add unnecessary_parenthesis
under linter > rules in your
analysis_options.yaml
file:
linter:
rules:
- unnecessary_parenthesis