titleCase function

String titleCase(
  1. String sentence
)

titleCase returns a title cased sentence

Implementation

String titleCase(String sentence) {
  return sentence
      .toLowerCase()
      .split(' ')
      .map((String e) => e.trim())
      .map((String word) => toBeginningOfSentenceCase(word))
      .join(' ');
}