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 {
var contextCollection = _contextCollection;
if (contextCollection != null) {
var analysisContext = contextCollection.contextFor(path);
var analysisSession = analysisContext.currentSession;
var 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),
);
}