getDirectoryPath static method

String getDirectoryPath(
  1. String filePath
)

Get directory path from file path

filePath - The file path Returns directory path

Implementation

static String getDirectoryPath(String filePath) {
  final lastSlash = filePath.lastIndexOf('/');
  if (lastSlash == -1) return '';
  return filePath.substring(0, lastSlash);
}