Why this matters
The spread operators (... and ...?) can flatten collections directly, making toList() redundant and less efficient.
toList() with Spread OperatorRemove unnecessary calls to .toList() when using the spread operator (...) as it is already designed to work with iterable collections.
The spread operators (... and ...?) can flatten collections directly, making toList() redundant and less efficient.
Side-by-side examples engineers can pattern-match during review.
final list = [
1,
2,
...anIterable.toList(), // Noncompliant
3,
4
];final list = [
1,
2,
...anIterable,
3,
4
];From the same buckets as this rule.