capitalize function Null safety

String capitalize(
  1. String input
)

Implementation

String capitalize(String input) => input.replaceFirstMapped(
    RegExp('(^|\s)[a-z]'), (match) => match.group(0)!.toUpperCase());