deviation 0.0.2 copy "deviation: ^0.0.2" to clipboard
deviation: ^0.0.2 copied to clipboard

A diff generation tool and library.

example/deviation.dart

import 'dart:io';

import 'package:deviation/deviation.dart';
import 'package:deviation/unified_diff.dart';

void main() {
  final sourceFile = File('source.txt');
  final targetFile = File('target.txt');

  final diffPatch = const DiffAlgorithm.myers().compute(
    sourceFile.readAsLinesSync(),
    targetFile.readAsLinesSync(),
  );

  print(UnifiedDiff.fromPatch(
    diffPatch,
    header: UnifiedDiffHeader.traditional(
      sourcePath: sourceFile.path,
      sourceModificationTime: sourceFile.lastModifiedSync(),
      targetPath: targetFile.path,
      targetModificationTime: targetFile.lastModifiedSync(),
    ),
  ));
}
0
likes
150
points
41
downloads

Publisher

verified publisherdartcommunity.dev

Weekly Downloads

A diff generation tool and library.

Repository (GitHub)
View/report issues

Topics

#diff #patch

Documentation

API reference

License

MIT (license)

Dependencies

meta

More

Packages that depend on deviation