toUri function

Uri toUri (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
p.toUri('/path/to/foo')
  // -> Uri.parse('file:///path/to/foo')

// Windows
p.toUri(r'C:\path\to\foo')
  // -> Uri.parse('file:///C:/path/to/foo')

// URL
p.toUri('http://dartlang.org/path/to/foo')
  // -> Uri.parse('http://dartlang.org/path/to/foo')

If path is relative, a relative URI will be returned.

p.toUri('path/to/foo') // -> Uri.parse('path/to/foo')

Implementation

Uri toUri(String path) => context.toUri(path);