toUri method
- String path
Returns the URI that represents path.
For POSIX and Windows styles, this will return a file: URI. For the URL
style, this will just convert path to a Uri.
// POSIX
context.toUri('/path/to/foo')
  // -> Uri.parse('file:///path/to/foo')
// Windows
context.toUri(r'C:\path\to\foo')
  // -> Uri.parse('file:///C:/path/to/foo')
// URL
context.toUri('https://dart.dev/path/to/foo')
  // -> Uri.parse('https://dart.dev/path/to/foo')
Implementation
Uri toUri(String path) {
  if (isRelative(path)) {
    return style.relativePathToUri(path);
  } else {
    return style.absolutePathToUri(join(current, path));
  }
}