flushAnalysisState method
Plugin implementations can use this method to flush the state of
analysis, so reduce the used heap size, after performing a set of
operations, e.g. in afterNewContextCollection
or handleAffectedFiles
.
The next analysis operation will be slower, because it will restore the state from the byte store cache, or recompute.
Implementation
Future<void> flushAnalysisState({
bool elementModels = true,
}) async {
final contextCollection = _contextCollection;
if (contextCollection != null) {
for (final analysisContext in contextCollection.contexts) {
if (elementModels) {
analysisContext.driver.clearLibraryContext();
}
}
}
}