CockpitObservation.fromJson constructor
Implementation
factory CockpitObservation.fromJson(Map<String, Object?> json) {
final interactiveElements =
(json['interactiveElements'] as List<Object?>? ?? const <Object?>[])
.cast<String>();
final diagnosticsArtifactJson =
json['diagnosticsArtifactRef'] as Map<Object?, Object?>?;
final summaryJson = json['summary'] as Map<Object?, Object?>?;
return CockpitObservation(
routeName: json['routeName'] as String?,
interactiveElements: interactiveElements,
phase: json['phase'] == null
? null
: CockpitObservationPhase.fromJson(json['phase']),
diagnosticLevel: json['diagnosticLevel'] == null
? null
: CockpitSnapshotProfile.fromJson(json['diagnosticLevel']),
truncated: json['truncated'] as bool? ?? false,
diagnosticsArtifactRef: diagnosticsArtifactJson == null
? null
: CockpitArtifactRef.fromJson(
Map<String, Object?>.from(diagnosticsArtifactJson),
),
summary: summaryJson == null
? null
: CockpitSnapshotSummary.fromJson(
Map<String, Object?>.from(summaryJson),
),
targetKind: json['targetKind'] == null
? null
: CockpitTargetKind.fromJson(json['targetKind']),
executionPlane: json['executionPlane'] == null
? null
: CockpitPlaneKind.fromJson(json['executionPlane']),
surfaceKind: json['surfaceKind'] == null
? null
: CockpitSurfaceKind.fromJson(json['surfaceKind']),
fallbackUsed: json['fallbackUsed'] as bool? ?? false,
);
}