parseDataClass property
Use JsonVisitor
to collect Metadata from dart class.
Implementation
AnalysisResult get parseDataClass {
final visitor = JsonVisitor();
try {
parseFile(
path: absolute.path,
featureSet: FeatureSet.latestLanguageVersion(),
).unit.declarations.accept(visitor);
// ignore: avoid_catching_errors
} catch (error) {
error.toString().log();
return const AnalysisResult(parent: null);
}
final types = visitor.collected;
return AnalysisResult(
parent: types.removeAt(0) as CustomType,
childrenCustomTypes: types.whereType<CustomType>().toSet(),
childrenEnumTypes: types.whereType<EnumType>().toSet(),
).normalizeParentTypeMembers;
}