directory static method
Returns the directory portion of path (without the trailing slash).
Implementation
static String directory(String path) {
final int slash = path.lastIndexOf(RegExp(r'[/\\]'));
if (slash <= 0) return slash == 0 ? path.substring(0, 1) : '.';
return path.substring(0, slash);
}