DiffResult class
An immutable entity representing the complete result of a diff comparison.
Contains all DiffLine entries along with summary statistics.
final result = await calculateDiff(
oldContent: oldText,
newContent: newText,
);
print('${result.additions} additions, ${result.deletions} deletions');
Constructors
-
DiffResult({required List<
DiffLine> lines, required int additions, required int deletions, required int modifications, required int unchanged, required int oldLineCount, required int newLineCount}) -
Creates an immutable diff result.
const
- DiffResult.empty()
-
Creates an empty diff result representing two identical, empty documents.
const
Properties
- additions → int
-
The number of lines added in the new content.
final
-
changedLines
→ List<
DiffLine> -
Returns only the lines that represent changes (added, removed, modified).
no setter
- deletions → int
-
The number of lines removed from the old content.
final
- hasChanges → bool
-
Returns
trueif there are any changes between the two contents.no setter - hashCode → int
-
The hash code for this object.
no setteroverride
- hasNoChanges → bool
-
Returns
trueif the two compared contents are identical (no changes).no setter -
lines
→ List<
DiffLine> -
The ordered list of diff lines representing the full comparison.
final
- modifications → int
-
The number of lines that were modified (exist in both but changed).
final
- newLineCount → int
-
The total number of lines in the new content.
final
- oldLineCount → int
-
The total number of lines in the old content.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- totalChanges → int
-
The total number of changed lines (additions + deletions + modifications).
no setter
- unchanged → int
-
The number of lines that are identical in both versions.
final
-
unchangedLines
→ List<
DiffLine> -
Returns only the lines that represent unchanged content.
no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override