convert method
convert the CoverageFile contents to standardize how paths are represented.
This normalizes the paths in coverage reports from Dart and Flutter projects.
Implementation
Stream<String> convert() {
return LineSplitter()
.bind(Utf8Decoder().bind(file.openRead()))
.map((String line) {
// If the line does not require processing
if (!line.startsWith('SF:')) {
return line;
}
final thisPath = line.substring(3);
final resolvedPath = !p.isAbsolute(thisPath) //
? p.join(packagePath, thisPath)
: thisPath;
return 'SF:$resolvedPath';
});
}