getResolvedUnitResult method
Return the result of analyzing the file with the given path
.
Throw a RequestFailure is the file cannot be analyzed.
Implementation
Future<ResolvedUnitResult> getResolvedUnitResult(String path) async {
final contextCollection = _contextCollection;
if (contextCollection != null) {
final analysisContext = contextCollection.contextFor(path);
final analysisSession = analysisContext.currentSession;
final unitResult = await analysisSession.getResolvedUnit(path);
if (unitResult is ResolvedUnitResult) {
return unitResult;
}
}
// Return an error from the request.
throw RequestFailure(
RequestErrorFactory.pluginError('Failed to analyze $path', null),
);
}