buildString function

String buildString(
  1. void builderAction(
    1. StringBuffer sb
    )
)

Builds new string by populating newly created StringBuffer using provided builderAction and then converting it to String.

Implementation

String buildString(void Function(StringBuffer sb) builderAction) {
  final buffer = StringBuffer();
  builderAction(buffer);
  return buffer.toString();
}