mukhtharcm.

The Dart String Trim method

All about Dart trim() method for string. Useful for removing whitespaces from start and end in Dart and Flutter Apps.

The Dart String Trim method

The Dart trim() method returns the given String after removing whitespaces at the beginning and end of the String.

Examples

" SampleText".trim() // "SampleText"
"SampleText ".trim() // "SampleText"
" SampleText ".trim() // "SampleText"
"SampleText".trim() // "SampleText"

Note that, this will not remove whitespace in the middle of a sentence.