Dart – Convert String to Lowercase

To convert a given string to lowercase in Dart, call toLowerCase() method on this string.

toLowerCase() method converts all the characters in this string to lowercase and returns the resulting string. The original string remains unchanged.

Syntax

The syntax to call toLowerCase() method on this string object str is

str.toLowerCase()
ADVERTISEMENT

Example

In this example, we take a string and convert this string to lowercase using String.toLowerCase() method.

main.dart

void main() {
  var str = 'Hello World';
  var result = str.toLowerCase();
  print(result);
}

Output

hello world

Conclusion

In this Dart Tutorial, we learned how to convert a given string to lowercase, using toLowerCase() method of String class, with examples.