DiffReviewRange constructor
DiffReviewRange(
- DiffCommentLineKey start, [
- DiffCommentLineKey? end
Creates a normalized range. Cross-file and cross-side ranges are rejected.
Implementation
factory DiffReviewRange(DiffCommentLineKey start, [DiffCommentLineKey? end]) {
end ??= start;
if (start.path != end.path ||
start.side != end.side ||
start.line <= 0 ||
end.line <= 0) {
throw ArgumentError(
'A review range must use positive lines on one file and side.',
);
}
return start.line <= end.line
? DiffReviewRange._(start, end)
: DiffReviewRange._(end, start);
}