toUri function
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('https://dart.cn/path/to/foo')
// -> Uri.parse('https://dart.cn/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);