isExcludedPath function

bool isExcludedPath(
  1. String relativePath
)

Whether relativePath sits inside a directory that should never be scanned (.dart_tool, .git, or build output).

Matches whole path segments, so .github/ or builders/ are not mistaken for .git/ or build/.

Implementation

bool isExcludedPath(String relativePath) {
  final segments = p.split(p.normalize(relativePath));
  if (segments.isEmpty) return false;
  return segments.contains('.dart_tool') ||
      segments.contains('.git') ||
      segments.first == 'build';
}