How to Convert String to Uppercase/Lowercase in Flutter/Dart

In this example, you will learn to convert any kind of string to an uppercase/capital letter or lowercase/small letter in Dart or Flutter. Changing string to upper case or lower case is very simple in Dart with a simple method call. See the example below:

String str1 = "Hello34#2SHADdfer";
print(str1.toUpperCase());
//Output: HELLO34#2SHADDFER

To convert any string to uppercase,  call String.toUpperCase() method and it will return the converted Uppercase string. 

See this also: How to Capitalize First Letter of Word and Sentence in Flutter

String str2 = "Hello34#2SHADdfer";
print(str2.toLowerCase());
//Output: hello34#2shaddfer

To convert any string to lowercase, call String.toLowerCase() method and it will return the converted Lowercase String.

In this way, you can convert any string to Uppercase or Lowercase in Dart or Flutter.

No any Comments on this Article


Please Wait...