directory property
String
directory
Returns the directory the file is located in. This it typically everything before the last /
or \
.
Note: Even on Windows and web platforms, where file paths are typically presented using \
instead
of /
, the path's single directories are separated using /
.
Implementation
String get directory {
final parsedPath = '/' + path!.replaceAll(r'\', r'/');
return parsedPath.substring(0, parsedPath.lastIndexOf('/'));
}