titleCase static method

String titleCase(
  1. String value
)

Capitalises the first letter of each word.

Implementation

static String titleCase(String value) => value
    .split(' ')
    .map(
      (w) =>
          w.isEmpty ? w : w[0].toUpperCase() + w.substring(1).toLowerCase(),
    )
    .join(' ');