toTitleCase function

String toTitleCase(
  1. String input
)

Converts the string to title case.

Implementation

String toTitleCase(String input) {
  return input.split(' ').map((word) {
    return word[0].toUpperCase() + word.substring(1).toLowerCase();
  }).join(' ');
}