baseName function
Return the first n - 1 segments of the file path.
Implementation
String baseName(FileSystemEntity entity) {
String name = entity.path;
int index = name.lastIndexOf(_sep);
return (index != -1 ? name.substring(0, index) : null);
}