ProgramRenderStats.fromJson constructor

ProgramRenderStats.fromJson(
  1. Map<Object?, Object?> json
)

Rebuilds aggregate render stats from serialized JSON data.

Implementation

factory ProgramRenderStats.fromJson(Map<Object?, Object?> json) {
  final lastChangeSummaryJson = _jsonObjectOrNull(json['lastChangeSummary']);
  return ProgramRenderStats(
    totalRenders: _jsonInt(json['totalRenders']),
    changedRenders: _jsonInt(json['changedRenders']),
    totalChangedCells: _jsonInt(json['totalChangedCells']),
    totalChangedSpans: _jsonInt(json['totalChangedSpans']),
    maxDirtyLines: _jsonInt(json['maxDirtyLines']),
    maxChangedCells: _jsonInt(json['maxChangedCells']),
    maxChangedSpans: _jsonInt(json['maxChangedSpans']),
    totalRenderDuration: Duration(
      microseconds: _jsonInt(json['totalRenderDurationUs']),
    ),
    lastRenderGeneration: _jsonNullableInt(json['lastRenderGeneration']),
    lastDegradationLevel: _jsonEnumByName(
      DegradationLevel.values,
      json['lastDegradationLevel'],
    ),
    lastChangeSummary: lastChangeSummaryJson == null
        ? null
        : ProgramRenderChangeSummary.fromJson(lastChangeSummaryJson),
  );
}