unwords function

String unwords(
  1. Iterable<String> listOfWords
)

Combines Strings into one with spaces in between.

Implementation

String unwords(Iterable<String> listOfWords) {
  if (listOfWords.isEmpty) {
    return '';
  }
  String result = '';
  for (String word in listOfWords) {
    result += ('$word ');
  }
  //remove space at the end
  result = result.replaceRange(result.length - 1, result.length, '');
  return result;
}