prettyUri function

String prettyUri(
  1. Object? 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

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(''); // -> ''

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

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


String prettyUri(Object? uri) => context.prettyUri(uri!);