getResolvedUnit method

Future<ResolvedUnitResult?> getResolvedUnit()

Uses the analyzer to resolve and return the AST result for this file, which includes the CompilationUnit.

If the fully resolved AST is not needed, use the much faster getUnresolvedUnit.

Implementation

Future<ResolvedUnitResult?> getResolvedUnit() async {
  final result = await _analysisContextCollection
      .contextFor(path)
      .currentSession
      .getResolvedUnit(path);
  return result is ResolvedUnitResult ? result : null;
}