There are no special methods to trim only leading or trailing spaces. But they are easy to implement:
/// trims leading whitespace String ltrim(String str) { return str.replaceFirst(new RegExp(r"^\s+"), ""); } /// trims trailing whitespace String rtrim(String str) { return str.replaceFirst(new RegExp(r"\s+$"), ""); }
Shailen tuli
source share