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