tryGetAstNodeForElement function
Future<AstNode>
tryGetAstNodeForElement(
- Element element,
- BuildStep buildStep
)
Implementation
Future<AstNode> tryGetAstNodeForElement(
Element element,
BuildStep buildStep,
) async {
var library = element.library!;
while (true) {
try {
final result = library.session.getParsedLibraryByElement2(library)
as ParsedLibraryResult?;
return result!.getElementDeclaration(element)!.node;
} on InconsistentAnalysisException {
library = await buildStep.resolver.libraryFor(
await buildStep.resolver.assetIdForElement(element.library!),
);
}
}
}