prefer-add-all
Suggests using .addAll()
instead of multiple .add()
invocations.
Example
❌ Bad:
void fn(List<String> values) {
values.add('first');
// LINT: Prefer 'addAll()' over multiple 'add()' invocations.
values.add('second');
}
✅ Good:
void fn(List<String> values) {
values.addAll(['first', 'second']);
}