getBaseName function
Return the name of the file or the folder
i.e: /root/home/myfile.zip = myfile.zip
extension
: with extension true
or not false
, true
by default
Implementation
String getBaseName(String? path, {bool extension: true}) {
if (extension) {
return pathlib.split(path!).last;
} else {
return pathlib.split(path!).last.split(new RegExp(r'\.\w+'))[0];
}
}