joinToString method
Join to String with separator, prefix and suffix, and transform function.
Returns a String with the elements joined by separator, prefix and suffix, and transformed by transform.
If transform is null, the elements are converted to String with toString().
Implementation
String joinToString(
String separator, {
String prefix = '',
String suffix = '',
String Function(T)? transform,
}) {
final buffer = StringBuffer();
buffer.write(prefix);
for (var i = 0; i < length; i++) {
if (i > 0) buffer.write(separator);
buffer.write(transform == null ? this[i].toString() : transform(this[i]));
}
buffer.write(suffix);
return buffer.toString();
}