afterNewContextCollection method

Future<void> afterNewContextCollection({
  1. required AnalysisContextCollection contextCollection,
})

This method is invoked when a new instance of AnalysisContextCollection is created, so the plugin can perform initial analysis of analyzed files.

By default analyzes every AnalysisContext with analyzeFiles.

Implementation

Future<void> afterNewContextCollection({
  required AnalysisContextCollection contextCollection,
}) async {
  await _forAnalysisContexts(contextCollection, (analysisContext) async {
    final paths = analysisContext.contextRoot.analyzedFiles().toList();
    await analyzeFiles(
      analysisContext: analysisContext,
      paths: paths,
    );
  });
}