ESC top-level property

Parser<String> ESC
final

Implementation

final Parser<String> ESC =
    ((char('\\') & pattern('`\'\\/fnrt')).flatten() |
            (char('\\') & UNICODE).map((value) {
              return String.fromCharCodes([
                int.parse(value[1].replaceAll('u', ''), radix: 16),
              ]);
            }))
        .map((value) {
          return value == r"\'"
              ? "'"
              : value == r"\`"
              ? '`'
              : jsonDecode('"$value"');
        });