capitalize function Null safety

String capitalize(
  1. String s
)

Implementation

String capitalize(String s) {
  if (s.length < 2) {
    return s.toUpperCase();
  }
  return s[0].toUpperCase() + s.substring(1);
}