title_case property

String? get title_case

Implementation

String? get title_case {
  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();
}