normalizePath static method

String normalizePath(
  1. String path
)

Normalizes a file path by resolving relative components and redundant separators

Example:

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

Implementation

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

  return p.normalize(path);
}