filePath property

String get filePath

Gets the directory path containing the file.

Returns the directory path where the file is located, without the file name itself. For example, if the file path is '/home/user/documents/file.txt', this returns '/home/user/documents'.

Example:

final file = File('/var/www/html/index.html');
print(file.filePath); // '/var/www/html'

Implementation

String get filePath {
  return p.dirname(path);
}