clearFileNameFromPath method

String clearFileNameFromPath(
  1. String path
)

Takes a file path as input and returns the path without the

Implementation

String clearFileNameFromPath(String path) {
  final fileName = _getFileNameFromPath(path);
  if (fileName != null) {
    return path
        .replaceAll(fileName, "")
        .replaceAll("$fileName/", "")
        .replaceAll("//", "/");
  } else {
    return path;
  }
}