isPartFile function
Implementation
bool isPartFile(String path) {
try {
final result = parseFile(
path: File(path).absolute.path,
featureSet: FeatureSet.latestLanguageVersion(),
throwIfDiagnostics: false,
);
return result.unit.directives.whereType<PartOfDirective>().isNotEmpty;
} catch (e) {
return false;
}
}