Uri.directory constructor

Uri.directory(
  1. String path, {
  2. bool? windows,
})

Like Uri.file except that a non-empty URI path ends in a slash.

If path is not empty, and it doesn't end in a directory separator, then a slash is added to the returned URI's path. In all other cases, the result is the same as returned by Uri.file.

Example:

final fileDirectory = Uri.directory('data/images', windows: false);
print(fileDirectory); // data/images/

final fileDirectoryWindows =
   Uri.directory(r'C:\data\images', windows: true);
print(fileDirectoryWindows); // file:///C:/data/images/

Implementation

factory Uri.directory(String path, {bool? windows}) = _Uri.directory;