dirname method

String dirname(
  1. String path
)

Gets the part of path before the last separator.

p.dirname('path/to/foo.dart'); // -> 'path/to'
p.dirname('path/to');          // -> 'path'

Trailing separators are ignored.

p.dirname('path/to/'); // -> 'path'

If an absolute path contains no directories, only a root, then the root is returned.

p.dirname('/');  // -> '/' (posix)
p.dirname('c:\');  // -> 'c:\' (windows)

If a relative path has no directories, then '.' is returned.

p.dirname('foo');  // -> '.'
p.dirname('');  // -> '.'

Implementation

String dirname(String path) => p.context.dirname(path);