newFile method
Creates or updates a file at path with the given content.
Line endings in content are normalized using normalizeSource, and the
file is added to relevant analysis drivers if analysis contexts have
already been created.
Throws a StateError if a non-Dart file is modified after the analysis context collection has already been initialized.
Implementation
@override
File newFile(String path, String content) {
if (_analysisContextCollection != null && !path.endsWith('.dart')) {
throw StateError('Only dart files can be changed after analysis.');
}
var file = super.newFile(path, normalizeSource(content));
_addAnalyzedFileToDrivers(file);
return file;
}