basename static method
Get the basename of Directory or File.
Provide File, Directory or FileSystemEntity and returns the name as a String.
ie:
controller.basename(dir);
to hide the extension of file, showFileExtension = flase
Implementation
static String basename(dynamic entity, {bool showFileExtension = true}) {
if (entity is! FileSystemEntity) return "";
final pathSegments = entity.path.split('/');
final filename = pathSegments.last;
if (showFileExtension) return filename;
return showFileExtension ? filename.split('.').first : filename;
}