trim method

LiteralString trim()

Removes non-escaped whitespaces

Implementation

LiteralString trim() {
  var s = string;
  s = s.replaceFirst(RegExp(r'^\s*'), '');
  s = s.replaceFirstMapped(RegExp(r"([^'])\s*$"), (m) => m.group(1)!);
  return LiteralString(s);
}