pathlib 2.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 40

pathlib #

Super easy object-oriented filesystem path operations for Dart inspired by Python3's pathlib. Includes addition, equality, iteration & relative path resolution out-of-the-box.

2.0.2 #

  • Fix examples

2.0.0 #

  • Breaking: Removed Path.list()
  • Added Path.home() constructor to get home directory
  • Added Path.dir, Path.file, and constructors Path.fromFile() & Path.fromDir() for increased interoperability with native dart:io Directory & File APIs
  • Documentation improvements

1.1.0 #

  • Added list() method to list files in a directory
  • Added hashCode override
  • Documentation improvements

1.0.1 #

  • Documentation update

1.0.0 #

Initial version!

  • Created Path class


Examples #

import "package:pathlib/pathlib.dart";

main() {
  var a = Path.root();
  a += Path("etc");
  a += Path("passwd");
import "package:pathlib/pathlib.dart";

main() {
  var h = Path.home();
  var a = h + Path(".bashrc");
  var b = h + Path("Documents/../.bashrc");
  print(a == b); // => true
import "package:pathlib/pathlib.dart";

main() {
  var a = Path.root();
  a += Path("etc");
  a += Path("apt");
  print(a.dir.listSync()); // => [File: '/etc/apt/apt.conf', Directory: '/etc/apt/sources.list.d', ...]

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  pathlib: ^2.0.2

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:pathlib/pathlib.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Feb 10, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5

Health suggestions

Format lib/pathlib.dart.

Run dartfmt to format lib/pathlib.dart.

Format lib/src/pathlib_base.dart.

Run dartfmt to format lib/src/pathlib_base.dart.

Maintenance suggestions

Package is getting outdated. (-29.59 points)

The package was last published 67 weeks ago.

The package description is too short. (-18 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
path ^1.4.1 1.6.4