DiffMatchPatch class

Class containing the diff, match and patch methods. Also contains the behaviour settings.

Constructors

DiffMatchPatch()

Properties

diffEditCost int
Cost of an empty edit operation in terms of edit characters.
getter/setter pair
diffTimeout double
Number of seconds to map a diff before giving up (0 for infinity).
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
matchDistance int
How far to search for a match (0 = exact location, 1000+ = broad match). A match this many characters away from the expected location will add 1.0 to the score (0.0 is a perfect match).
getter/setter pair
matchThreshold double
At what point is no match declared (0.0 = perfection, 1.0 = very loose).
getter/setter pair
patchDeleteThreshold double
When deleting a large block of text (over ~64 characters), how close do the contents have to be to match the expected contents. (0.0 = perfection, 1.0 = very loose). Note that matchThreshold controls how closely the end points of a delete need to match.
getter/setter pair
patchMargin int
Chunk size for context length.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

diff(String text1, String text2, [bool checklines = true, DateTime? deadline]) List<Diff>
Find the differences between two texts. Simplifies the problem by stripping any common prefix or suffix off the texts before diffing.
diff_levenshtein(List<Diff> diffs) int
Compute the Levenshtein distance; the number of inserted, deleted or substituted characters.
diffCleanupEfficiency(List<Diff> diffs) → void
Reduce the number of edits by eliminating operationally trivial equalities.
diffCleanupSemantic(List<Diff> diffs) → void
Reduce the number of edits by eliminating semantically trivial equalities.
match(String text, String pattern, int loc) int
Locate the best instance of pattern in text near loc. Returns -1 if no match found.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
patch(Object a, [Object? opt_b, Object? opt_c]) List<Patch>
Compute a list of patches to turn text1 into text2. Use diffs if provided, otherwise compute it ourselves.
patch_apply(List<Patch> patches, String text) List
Merge a set of patches onto the text. Return a patched text, as well as an array of true/false values indicating which patches were applied.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited