humanize method

String humanize()

Converts a string into a human-readable form.

Implementation

String humanize() {
  if (this == null) {
    throw ArgumentError('string: $this');
  }
  if (this!.isEmpty) {
    return '';
  }
  return this!
      .replaceAllMapped(RegExp(r'([A-Z])'), (match) => ' ${match[1]}')
      .trim()
      .toLowerCase();
}