fileName property

String get fileName

Gets the file name without the extension.

Returns the base name of the file without its extension. For example, if the file path is '/home/user/document.pdf', this returns 'document'.

Example:

final file = File('/downloads/report.xlsx');
print(file.fileName); // 'report'

Implementation

String get fileName {
  return p.basenameWithoutExtension(path);
}