title method

String title()

Convert snake_case / kebab-case / comma,separated to Title Case.

Implementation

String title() {
  final words = replaceAll(RegExp(r'[-,_]'), ' ').split(' ');
  return words.map((word) => word.firstUpper()).join(' ');
}