Skip to content

Files

Latest commit

 

History

History
23 lines (16 loc) · 509 Bytes

prefer_inlined_adds.md

File metadata and controls

23 lines (16 loc) · 509 Bytes

Pattern: Missing use of inlined list item declaration

Issue: -

Description

Declare elements in list literals inline, rather than using add and addAll methods where possible.

Example of incorrect code:

var l = ['a']..add('b')..add('c');
var l2 = ['a']..addAll(['b', 'c'])

Example of correct code:

var l = ['a', 'b', 'c'];
var 2 = ['a', 'b', 'c'];

Further Reading