computeFileDiff method
Compute a FileDiff by reading files at oldPath and newPath.
Implementation
Future<FileDiff> computeFileDiff(String oldPath, String newPath) async {
final oldFile = File(oldPath);
final newFile = File(newPath);
final oldText = await oldFile.exists() ? await oldFile.readAsString() : '';
final newText = await newFile.exists() ? await newFile.readAsString() : '';
final hunks = computeDiff(oldText, newText);
final stats = _computeStats(hunks);
return FileDiff(
path: newPath,
oldPath: oldPath,
hunks: hunks,
stats: stats,
);
}