/// Patch value objects produced by the unified-patch parser. Kept separate from /// the parser so widgets import the smallest model they need. library; enum ChangeLineKind { context, add, remove } class PatchLine { const PatchLine({ required this.kind, required this.text, required this.oldLine, required this.newLine, this.noNewlineMarker = false, }); final ChangeLineKind kind; final String text; final int oldLine; final int newLine; /// A `\ No newline at end of file` marker: shown verbatim, never numbered. final bool noNewlineMarker; } class PatchHunk { const PatchHunk({ required this.header, required this.oldStart, required this.oldCount, required this.newStart, required this.newCount, required this.lines, }); final String header; final int oldStart; final int oldCount; final int newStart; final int newCount; final List lines; } class ParsedPatch { const ParsedPatch({ required this.raw, required this.headerLines, required this.hunks, required this.added, required this.removed, }); final String raw; final List headerLines; final List hunks; final int added; final int removed; bool get isEmpty => hunks.isEmpty; }