parentPath method
Get the path of the parent from the current string.
By entering separator
, it can be used for purposes other than paths.
Implementation
String parentPath({String separator = "/"}) {
if (isEmpty) {
return this;
}
final path = trimString(separator);
return path.replaceAll(_tail, "").trimStringRight(separator);
}