getPathWithoutFileName function
Returns path
removing File name if present.
Implementation
String? getPathWithoutFileName(String? path) {
if (path == null) return null;
path = path.trim();
if (path.isEmpty) return null;
var idx = path.lastIndexOf(RegExp(r'[/\\]'));
if (idx < 0) return path;
var onlyPath = path.substring(0, idx + 1);
return onlyPath;
}