Check if the path matches a specific pattern using a callback
bool matchesPattern(bool Function(List<String> path) matcher) => matcher(path);