isSameOrChild method

bool isSameOrChild(
  1. String refPath,
  2. String filePath
)

Determines whether filePath is exactly refPath or a child of it.

Useful for ignoring entire directories.

Implementation

bool isSameOrChild(String refPath, String filePath) {
  final ref = p.normalize(p.absolute(refPath));
  final file = p.normalize(p.absolute(filePath));

  return ref == file || p.isWithin(ref, file);
}