prettyUri function

String prettyUri (dynamic uri)

Returns a terse, human-readable representation of uri.

uri can be a String or a Uri. If it can be made relative to the current working directory, that's done. Otherwise, it's returned as-is. This gracefully handles non-file: URIs for Style.posix and Style.windows.

The returned value is meant for human consumption, and may be either URI- or path-formatted.

// POSIX at "/root/path"
p.prettyUri('file:///root/path/a/b.dart'); // -> 'a/b.dart'
p.prettyUri('http://dartlang.org/'); // -> 'http://dartlang.org'

// Windows at "C:\root\path"
p.prettyUri('file:///C:/root/path/a/b.dart'); // -> r'a\b.dart'
p.prettyUri('http://dartlang.org/'); // -> 'http://dartlang.org'

// URL at "http://dartlang.org/root/path"
p.prettyUri('http://dartlang.org/root/path/a/b.dart'); // -> r'a/b.dart'
p.prettyUri('file:///root/path'); // -> 'file:///root/path'

Implementation

String prettyUri(uri) => context.prettyUri(uri);