prefixWithSlash method

String prefixWithSlash()

If the string is not already prefixed with a slash, prefix it with one.

Implementation

String prefixWithSlash() {
  if (startsWith('/')) return this;
  return '/$this';
}