FileDiff class final

The changes to one file.

Constructors

FileDiff({required String? oldPath, required String? newPath, required FileDiffKind kind, required List<DiffHunk> hunks, bool isBinary = false, List<String>? oldLines, List<String>? newLines, String? identity, int revision = 0, String? language, String? oldText, String? newText, String? oldObjectId, String? newObjectId, String? oldMode, String? newMode, String patchLineEnding = '\n'})
The changes to one file. Only diffTexts fills in oldLines and newLines.
const

Properties

additions → int
How many lines were added.
no setter
deletions → int
How many lines were removed.
no setter
hashCode → int
The hash code for this object.
no setterinherited
hunks → List<DiffHunk>
The changed regions, in file order. Empty for a binary file, a pure rename or copy, or a mode change.
final
id → String
Stable key for retained UI state.
no setter
identity → String?
Stable caller-supplied identity; defaults to the pair of paths.
final
isBinary → bool
Whether the patch marks the file as binary, which has no lines.
final
isPartial → bool
Whether unchanged content is unavailable.
no setter
isRenameOrCopy → bool
Whether the file was renamed or copied, so it has an old and a new path to show.
no setter
kind → FileDiffKind
What happened to the file.
final
language → String?
Explicit language override.
final
maxLineNumber → int
The largest line number a view of this diff can show, for sizing a line-number gutter. With the full texts, that includes every line of both files, since unchanged lines can be expanded.
no setter
newLines → List<String>?
See oldLines.
final
newMode → String?
Updated Git file mode when supplied by the patch.
final
newObjectId → String?
New Git object identifier when present in the patch header.
final
newPath → String?
Path after the change, or null for a deleted file.
final
newText → String?
Complete new-side source, preserving terminators, or null for a partial patch.
final
oldLines → List<String>?
The complete old and new files, when known. Diffs built with diffTexts have them, which lets a viewer show the unchanged lines between hunks. Parsed patches do not.
final
oldMode → String?
Original Git file mode when supplied by the patch.
final
oldObjectId → String?
Object IDs and modes recorded in Git patch headers.
final
oldPath → String?
Path before the change, or null for an added file.
final
oldText → String?
Complete source texts, including their original line endings.
final
patchLineEnding → String
Transport line ending used by the original patch.
final
path → String
The path to show: the new path, or the old one for a deleted file.
no setter
revision → int
Content revision for asynchronous operations.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

changeBlocks() → ({int added, int removed})
How many of the changeBarSize squares go to additions and to deletions. Each kind of change that happened gets at least one. Without changes, both are 0.
copyWith({List<DiffHunk>? hunks, List<String>? oldLines, List<String>? newLines, String? oldText, String? newText, int? revision, String? patchLineEnding, String? language, String? identity}) → FileDiff
Replaces computed data while preserving source metadata and identity. Changing a known full source invalidates that side's Git object ID.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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

Constants

changeBarSize → const int
The number of squares in a GitHub-style change bar.