camelCaseToTitleCase function

String camelCaseToTitleCase(
  1. String label
)

Implementation

String camelCaseToTitleCase(String label) => label
    .replaceAllMapped(RegExp(r'(?!^)([A-Z])'), (Match match) => ' ${match.group(1)}')
    .split(' ')
    .map((String s) => s[0].toUpperCase() + s.substring(1).toLowerCase())
    .join(' ');