Trim spaces from given string.
String trim(String str) { return str.replaceAll(RegExp(r'^\s+|\s+$'), ''); }