capitalizeFirstLetter function

String? capitalizeFirstLetter(
  1. String? text
)

Capitalize the first letter if required

Implementation

String? capitalizeFirstLetter(String? text) {
  if (text != null && text.isNotEmpty ) {
    return text.substring(0, 1).toUpperCase() + text.substring(1);
  }
  return text;
}