AnalysisContextCollection constructor

AnalysisContextCollection({
  1. List<String> enabledExperiments = const [],
  2. required List<String> includedPaths,
  3. Version? languageVersionOverride,
  4. ResourceProvider? resourceProvider,
  5. String? sdkPath,
})

Initialize a newly created collection of analysis contexts that can analyze the files that are included by the list of includedPaths.

All paths must be absolute and normalized.

If a resourceProvider is given, then it will be used to access the file system, otherwise the default resource provider will be used.

If sdkPath is given, then Dart SDK at this path will be used, otherwise the default Dart SDK will be used.

If languageVersionOverride is given, it replaces the default language version determined from package or workspace configuration for non-SDK files. A // @dart= comment in a file still takes precedence.

If enabledExperiments is not empty, these experiment flags, such as foo to enable and no-foo to disable the experiment foo, replace the experiments from all analysis options files. Otherwise, experiments from analysis options files are used. Unknown and expired flags are ignored.

dispose must be invoked after collection is finished being used.

Implementation

factory({
  List<String> enabledExperiments = const [],
  required List<String> includedPaths,
  Version? languageVersionOverride,
  ResourceProvider? resourceProvider,
  String? sdkPath,
}) {
  return AnalysisContextCollectionImpl(
    enabledExperiments: enabledExperiments,
    includedPaths: includedPaths,
    languageVersionOverride: languageVersionOverride,
    resourceProvider: resourceProvider,
    sdkPath: sdkPath,
  );
}