reload method

Future<void> reload()

Reloads the analyzer.

This is only needed to be called when a dependency has changed. The analyzer groups packages into their own contexts. Because of this, dependencies are only resolved and cached when the analyzer is initialized.

This refreshes all dependency files in the memory provider and notifies the analysis context of changes, similar to how same-package file changes are handled.

Implementation

Future<void> reload() async {
  final root = _root;
  if (root == null) {
    throw Exception('No root found');
  }

  // Refresh all dependency files in the
  // memory provider and notify the context
  await refreshDependencies();
}