StringBuilder.withCapacity constructor

StringBuilder.withCapacity(
  1. int capacity
)

Creates a StringBuilder with initial capacity (ignored in Dart).

A mutable sequence of characters similar to Java's StringBuilder.

This class provides an efficient way to build strings by appending characters, strings, and other data types.

Example usage:

StringBuilder sb = StringBuilder();
sb.append("Hello");
sb.append(" ");
sb.append("World");
sb.append("!");

print(sb.toString()); // "Hello World!"
print(sb.length()); // 12

Implementation

StringBuilder.withCapacity(int capacity) : _buffer = StringBuffer();