layoutDiff function
Lays out files as the rows a diff view shows, top to bottom.
Each file with a path starts with a DiffFileHeaderRow, and files
whose index is in collapsed stop there. A file without a path has no
header to expand it again, so it is never collapsed. A file without
hunks gets a DiffNoticeRow. When a file has its full texts, as from
diffTexts, the unchanged lines around hunks become DiffGapRows, or
context lines when their DiffGapId is in expanded. The hunk header
after an expanded gap is left out, since the code then runs on without
a break.
collapsed and expanded refer to files by index, so start them
afresh when files changes. The result is empty only when files is.
Implementation
List<DiffRow> layoutDiff(
List<FileDiff> files, {
DiffMode mode = DiffMode.unified,
Set<int> collapsed = const {},
Set<DiffGapId> expanded = const {},
}) => DiffLayout(files, mode: mode, collapsed: collapsed, expanded: expanded);