diff_match_patch 0.3.0

  • README.md
  • Installing
  • Versions
  • 86

Diff Match Patch

This is a port of google-diff-match-patch library to Dart. Initially maintained by localvoid, handed off to jheyne for upgrades.


This library implements Myer's diff algorithm which is generally considered to be the best general-purpose diff. A layer of pre-diff speedups and post-diff cleanups surround the diff algorithm, improving both performance and output quality.

This library also implements a Bitap matching algorithm at the heart of a flexible matching and patching strategy.

v0.3.0 (2018-10-10)

  • Support for Dart 2.0

v0.2.2 (2018-10-09)

  • Fix implementation of Diff == (and added hashcode)
  • Upgrade from unittest to test package

v0.2.1 (2014-10-01)

  • Update docs to use proper markdown for dartdocs.org

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  diff_match_patch: ^0.3.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:diff_match_patch/diff_match_patch.dart';
Version Uploaded Documentation Archive
0.3.0 Oct 9, 2018 Go to the documentation of diff_match_patch 0.3.0 Download diff_match_patch 0.3.0 archive
0.2.2 Oct 9, 2018 Go to the documentation of diff_match_patch 0.2.2 Download diff_match_patch 0.2.2 archive
0.2.1 Oct 1, 2014 Go to the documentation of diff_match_patch 0.2.1 Download diff_match_patch 0.2.1 archive
0.2.0 Jul 22, 2014 Go to the documentation of diff_match_patch 0.2.0 Download diff_match_patch 0.2.0 archive
0.1.0 Jul 3, 2014 Go to the documentation of diff_match_patch 0.1.0 Download diff_match_patch 0.1.0 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Dec 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:diff_match_patch/diff_match_patch.dart.

Health suggestions

Format lib/diff_match_patch.dart.

Run dartfmt to format lib/diff_match_patch.dart.

Format lib/src/api.dart.

Run dartfmt to format lib/src/api.dart.

Format lib/src/common.dart.

Run dartfmt to format lib/src/common.dart.

Fix additional 8 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/diff/cleanup.dart (Run dartfmt to format lib/src/diff/cleanup.dart.)
  • lib/src/diff/delta.dart (Run dartfmt to format lib/src/diff/delta.dart.)
  • lib/src/diff/diff.dart (Run dartfmt to format lib/src/diff/diff.dart.)
  • lib/src/diff/half_match.dart (Run dartfmt to format lib/src/diff/half_match.dart.)
  • lib/src/diff/main.dart (Run dartfmt to format lib/src/diff/main.dart.)
  • lib/src/diff/utils.dart (Run dartfmt to format lib/src/diff/utils.dart.)
  • lib/src/match.dart (Run dartfmt to format lib/src/match.dart.)
  • lib/src/patch.dart (Run dartfmt to format lib/src/patch.dart.)

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use diff_match_patch.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
Dev dependencies
test any