escape method

Anonymous escape (
  1. Node str
)

Applies URL-encoding to special characters found in the input string. These characters are not encoded: ,, /, ?, @, &, +, ', ~, ! and $. Most common encoded characters are: <space>, #, ^, (, ), {, }, |, :, >, <, ;, ], [ and =.

Parameters: string: a string to escape. Returns: escaped string content without quotes. Example: escape('a=1') Output: a%3D1 Note: if the parameter is not a string, output is not defined. The current implementation returns undefined on color and unchanged input on any other kind of argument. This behavior should not be relied on and may change in the future.

Implementation

Anonymous escape(Node str) => Anonymous(Uri.encodeFull(str.value)
  ..replaceAll(RegExp(r'='), '%3D')
  ..replaceAll(RegExp(r':'), '%3A')
  ..replaceAll(RegExp(r'#'), '%23')
  ..replaceAll(RegExp(r';'), '%3B')
  ..replaceAll(RegExp(r'\('), '%28')
  ..replaceAll(RegExp(r'\)'), '%29'));