changeFile abstract method

void changeFile(
  1. String path
)

Schedules the file with the path to be read before producing new analysis results.

The file is expected to be a Dart file, reporting non-Dart files, such as configuration files analysis_options.yaml, package_config.json, etc will not re-create analysis contexts.

This will invalidate any previously returned AnalysisSession, to get a new analysis session apply pending file changes:

analysisContext.changeFile(...);
await analysisContext.applyPendingFileChanges();
var analysisSession = analysisContext.currentSession;
var resolvedUnit = analysisSession.getResolvedUnit(...);

Implementation

void changeFile(String path);