ProgramRenderSnapshot.fromJson constructor
Rebuilds a snapshot from serialized JSON data.
Implementation
factory ProgramRenderSnapshot.fromJson(Map<Object?, Object?> json) {
final lines = _jsonStringList(json['lines']);
final content = lines.join('\n');
final view = View(content: content);
return ProgramRenderSnapshot(
sequence: _jsonInt(json['sequence']),
renderGeneration: _jsonInt(json['renderGeneration']),
view: view,
frame: TerminalRenderFrame.inspect(view),
degradationLevel:
_jsonEnumByName(DegradationLevel.values, json['degradationLevel']) ??
DegradationLevel.full,
renderDuration: Duration(
microseconds: _jsonInt(json['renderDurationUs']),
),
width: _jsonNullableInt(json['width']),
height: _jsonNullableInt(json['height']),
);
}