getCollection function
Implementation
AnalysisContextCollection? getCollection(String codePath) {
final projectRootPath = getProjectRootPath(scriptPath: codePath);
if (projectRootPath == null) {
return null;
}
final sdkPath = getSdkPath();
if (sdkPath == null) {
print(
"-- ERROR: Could not find a valid Dart SDK."
"-- Please ensure FLUTTER_ROOT is set or the script is run with a Dart executable from an SDK.",
);
return null;
}
final collection = AnalysisContextCollection(
includedPaths: [projectRootPath],
resourceProvider: PhysicalResourceProvider.INSTANCE,
sdkPath: sdkPath,
);
return collection;
}