addAsTitle static method

String addAsTitle(
  1. String a,
  2. String b
)

Concatenates strings and converts to title case.

Implementation

static String addAsTitle(String a, String b) {
  final result = '$a $b';
  return result
      .split(' ')
      .map((word) => word.isNotEmpty
          ? '${word[0].toUpperCase()}${word.substring(1).toLowerCase()}'
          : word)
      .join(' ');
}