extractPath static method

String extractPath(
  1. String fullPath
)

Extracts the directory path from a full file path

Example:

  • extractPath('/path/to/file.dart') returns '/path/to'
  • extractPath('file.dart') returns '.'

Implementation

static String extractPath(String fullPath) {
  if (fullPath.isEmpty) {
    throw ArgumentError('Path cannot be empty');
  }

  return p.dirname(fullPath);
}