parent property

FilePath? parent

Returns the containing Path. Returns a non-null value even if this is a root directory.

See FileSystemEntity.parent.

Implementation

FilePath? get parent {
  final index = _path.lastIndexOf(_sep);

  // Do string manipulation if there are path separators; otherwise, use the
  // file system entity information.
  if (index == 0 || index == -1) {
    return entity == null ? null : FilePath(entity!.parent);
  } else {
    return FilePath(_path.substring(0, index));
  }
}