I am using this string formatter to have first char toUpperCase in given string (user name), however, if user name is whole in capital letters than it's obviousy gives me nothing. Do you have any idea how to refactor it to make whole string toLowerCase and then make first one capital?
static String upperFirstCase(String str) {
return "${str[0].toUpperCase()}${str.substring(1)}";
}