capitalize function Null safety

String capitalize(
  1. String input
)

Capitalize a String value. Accepts an input and returns a String.

Implementation

String capitalize(String input) {
  if (input.isEmpty) {
    return input;
  }
  return input[0].toUpperCase() + input.substring(1);
}