DiffService class
Service for computing diffs, applying patches, and performing merges.
Constructors
- DiffService({int defaultContextLines = 3})
Properties
- defaultContextLines → int
-
Default number of context lines around changes.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
applyPatch(
String original, List< DiffHunk> hunks) → String -
Apply a list of
hunkstooriginaltext and return the result. -
computeDiff(
String oldText, String newText, {DiffAlgorithm algorithm = DiffAlgorithm.myers, int? contextLines}) → List< DiffHunk> -
Compute the diff between
oldTextandnewText. -
computeDirectoryDiff(
String oldDir, String newDir) → Future< List< FileDiff> > -
Compute diffs for every file that differs between
oldDirandnewDir. -
computeFileDiff(
String oldPath, String newPath) → Future< FileDiff> -
Compute a FileDiff by reading files at
oldPathandnewPath. -
formatSideBySide(
FileDiff diff, {int width = 120}) → String - Format a FileDiff as a side-by-side comparison.
-
formatUnifiedDiff(
FileDiff diff, {int? contextLines}) → String - Format a FileDiff as a unified diff string.
-
highlightInlineDiff(
String oldLine, String newLine) → (List< InlineSpan> , List<InlineSpan> ) -
Compute word-level inline diff between
oldLineandnewLine. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
parsePatch(
String patchText) → List< FileDiff> - Parse a unified diff / patch string into a list of FileDiff.
-
reversePatch(
List< DiffHunk> hunks) → List<DiffHunk> - Reverse a patch so that applying the reversed hunks undoes the original.
-
threeWayMerge(
String base, String ours, String theirs) → MergeResult -
Perform a three-way merge between
base,ours, andtheirs. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited