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.