titleCase property

String? get titleCase

Implementation

String? get titleCase {
  if (this == null) return null;
  if (this!.isEmpty) return this;
  return this!
      .replaceAllMapped(
          RegExp(r'[A-Z]'), (Match m) => ' ${m[0]!.toLowerCase()}')
      .replaceAllMapped(RegExp(r'^[a-z]'), (Match m) => m[0]!.toUpperCase())
      .trim();
}