use_string_buffers

Group: style

Maturity: stable

Linter v0.1.31

Since info is static, may be stale

View all Lint Rules

Using the Linter

DO use string buffers to compose strings.

In most cases, using a string buffer is preferred for composing strings due to its improved performance.

BAD:

String foo() {
  final buffer = '';
  for (int i = 0; i < 10; i++) {
    buffer += 'a'; // LINT
  }
  return buffer;
}

GOOD:

String foo() {
  final buffer = StringBuffer();
  for (int i = 0; i < 10; i++) {
    buffer.write('a');
  }
  return buffer.toString();
}