getParentPath static method

String getParentPath(
  1. String path
)

Get parent directory path.

path - File or directory path. Example: geopod/data/places/places.jsongeopod/data/places/

Implementation

static String getParentPath(String path) {
  final cleanPath = path.endsWith('/')
      ? path.substring(0, path.length - 1)
      : path;
  final lastSlash = cleanPath.lastIndexOf('/');
  if (lastSlash <= 0) return '/';
  return '${cleanPath.substring(0, lastSlash)}/';
}