CockpitPerformanceReport.fromJson constructor
CockpitPerformanceReport.fromJson(
- Object? value
Implementation
factory CockpitPerformanceReport.fromJson(Object? value) {
final json = _object(value, r'$.performance');
final dropped = json['dropped'];
final droppedJson = dropped == null
? const <String, Object?>{}
: _object(dropped, r'$.performance.dropped');
final rawFrames = json['frames'];
final rawEvents = json['events'];
return CockpitPerformanceReport(
schemaVersion: _string(json['schema'], r'$.performance.schema'),
startedAt: _date(json['started'], r'$.performance.started'),
finishedAt: _date(json['finished'], r'$.performance.finished'),
durationUs: _nonNegativeInt(
json['durationUs'],
r'$.performance.durationUs',
),
durationMs: _nonNegativeInt(
json['durationMs'],
r'$.performance.durationMs',
),
platform: _string(json['platform'], r'$.performance.platform'),
buildMode: _string(json['build'], r'$.performance.build'),
mode: CockpitPerformanceMode.fromJson(json['mode']),
summary: CockpitPerformanceSummary.fromJson(json['summary']),
frames: rawFrames == null
? const <CockpitPerformanceFrame>[]
: _list(
rawFrames,
r'$.performance.frames',
).map(CockpitPerformanceFrame.fromJson).toList(growable: false),
events: rawEvents == null
? const <CockpitPerformanceEvent>[]
: _list(
rawEvents,
r'$.performance.events',
).map(CockpitPerformanceEvent.fromJson).toList(growable: false),
droppedFrames: droppedJson['frames'] == null
? 0
: _nonNegativeInt(
droppedJson['frames'],
r'$.performance.dropped.frames',
),
droppedEvents: droppedJson['events'] == null
? 0
: _nonNegativeInt(
droppedJson['events'],
r'$.performance.dropped.events',
),
invalidFrames: droppedJson['badFrames'] == null
? 0
: _nonNegativeInt(
droppedJson['badFrames'],
r'$.performance.dropped.badFrames',
),
invalidEvents: droppedJson['badEvents'] == null
? 0
: _nonNegativeInt(
droppedJson['badEvents'],
r'$.performance.dropped.badEvents',
),
memory: json['memory'] == null
? null
: CockpitPerformanceMemoryReport.fromJson(json['memory']),
devTools: json['devtools'] == null
? null
: CockpitDevToolsProfile.fromJson(json['devtools']),
timelineSource: _optionalString(json['source'], r'$.performance.source'),
stepId: _optionalString(json['step'], r'$.performance.step'),
archive: json['stream'] == null
? null
: CockpitPerformanceArchiveInfo.fromJson(json['stream']),
plugins: json['plugins'] == null
? const <CockpitPerformancePluginStats>[]
: _list(json['plugins'], r'$.performance.plugins')
.map(CockpitPerformancePluginStats.fromJson)
.toList(growable: false),
);
}