ProgramRenderCaptureReport.fromJson constructor

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

Rebuilds a capture report from serialized JSON data.

Implementation

factory ProgramRenderCaptureReport.fromJson(Map<Object?, Object?> json) {
  final metricEntries = <String, String>{};
  final rawEntries = _jsonObjectOrEmpty(json['metricEntries']);
  final lastChangeSummaryJson = _jsonObjectOrNull(json['lastChangeSummary']);
  for (final entry in rawEntries.entries) {
    if (entry.key is String && entry.value is String) {
      metricEntries[entry.key as String] = entry.value as String;
    }
  }
  return ProgramRenderCaptureReport(
    prefix: json['prefix'] as String? ?? 'Render',
    metricEntries: metricEntries,
    lastRenderGeneration: _jsonNullableInt(json['lastRenderGeneration']),
    lastWidth: _jsonNullableInt(json['lastWidth']),
    lastHeight: _jsonNullableInt(json['lastHeight']),
    frameLines: _jsonStringList(json['frameLines']),
    lastChangeSummary: lastChangeSummaryJson == null
        ? null
        : ProgramRenderChangeSummary.fromJson(lastChangeSummaryJson),
  );
}