humanize function

String humanize(
  1. String text
)

Convert a programmatic identifier to human-readable text.

Implementation

String humanize(String text) {
  final words = _splitWords(text);
  if (words.isEmpty) return '';
  return words.first[0].toUpperCase() +
      words.first.substring(1).toLowerCase() +
      (words.length > 1
          ? ' ${words.skip(1).map((w) => w.toLowerCase()).join(' ')}'
          : '');
}