getFileNameWithoutExtension method
Returns the file name without the extension.
e.g. "image.png" -> "image" Returns an empty string if the file name is null.
Implementation
String getFileNameWithoutExtension() {
if (name == null) {
return '';
}
final pathParts = name!.split('.');
if (pathParts.length > 1) {
pathParts.removeLast();
}
return pathParts.join('.');
}