Skip to content

Files

Latest commit

 

History

History
41 lines (30 loc) · 1.08 KB

require_trailing_commas.md

File metadata and controls

41 lines (30 loc) · 1.08 KB

Pattern: Missing use of trailing comma

Issue: -

Description

DO use trailing commas for all function calls and declarations unless the function call or definition, from the start of the function name up to the closing parenthesis, fits in a single line.

Example of correct code:

void run() {
 method(
  'does not fit on one line',
  'test test test test test test test test test test test',
 );
}

Example of incorrect code:

void run() {
 method('does not fit on one line',
   'test test test test test test test test test test test');
}

Exception: If the final parameter/argument is positional (vs named) and is either a function literal implemented using curly braces, a literal map, a literal set or a literal array. This exception only applies if the final parameter does not fit entirely on one line.

Note: This lint rule assumes dartfmt has been run over the code and may produce false positives until that has happened.

Further Reading