capitalizeMaybeNull property

String? capitalizeMaybeNull

Capitalize the first letter in a string. If string is null, we get null back.

Implementation

String? get capitalizeMaybeNull {
  if (this == null) {
    return this;
  } else {
    return ((this?.length ?? 0) > 1)
        ? (this?[0].toUpperCase() ?? '') + (this?.substring(1) ?? '')
        : this?.toUpperCase() ?? '';
  }
}