unnecessary_parenthesis

Group: style

Maturity: stable

Dart SDK: >= 2.0.0 • (Linter v0.1.44)

Since info is static, may be stale
has-fix

View all Lint Rules

Using the Linter

AVOID 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:

Usage

To enable the unnecessary_parenthesis lint, add unnecessary_parenthesis under linter > rules in your analysis_options.yaml file:

linter:
  rules:
    - unnecessary_parenthesis