static String sort(String s) { var words = s.split(RegExp('\\s+'))..sort(); var joined = words.join(' '); return joined.trim(); }