UnifiedDiff.fromPatch constructor
UnifiedDiff.fromPatch(
- Patch<
String> patch, { - required UnifiedDiffHeader header,
- int context = 3,
- UnifiedDiffHunkHeaderConfig hunkHeaderConfig = const UnifiedDiffHunkHeaderConfig(),
Create a UnifiedDiff from the specified patch
using the information from the header
.
By default context
is 3
, resulting in 3 lines of code included
on either side of a change for contextual purposes.
To configure the header format for each hunk, pass in a custom UnifiedDiffHunkHeaderConfig.
Implementation
factory UnifiedDiff.fromPatch(
final Patch<String> patch, {
required final UnifiedDiffHeader header,
final int context = 3,
final UnifiedDiffHunkHeaderConfig hunkHeaderConfig =
const UnifiedDiffHunkHeaderConfig(),
}) {
final hunks = _calculateHunksFromPatch(patch, hunkHeaderConfig, context);
return UnifiedDiff._(header, hunks);
}