CockpitScreenshotRequest.fromJson constructor

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

Decodes a CockpitScreenshotRequest from a JSON object.

Implementation

factory CockpitScreenshotRequest.fromJson(Map<String, Object?> json) {
  final snapshotOptionsJson =
      json['snapshotOptions'] as Map<Object?, Object?>?;
  final cropLocatorJson = json['cropLocator'] as Map<Object?, Object?>?;
  return CockpitScreenshotRequest(
    reason: CockpitScreenshotReason.fromJson(json['reason']),
    name: json['name']! as String,
    includeSnapshot: json['includeSnapshot'] as bool? ?? false,
    attachToStep: json['attachToStep'] as bool? ?? false,
    snapshotOptions: snapshotOptionsJson == null
        ? null
        : CockpitSnapshotOptions.fromJson(
            Map<String, Object?>.from(snapshotOptionsJson),
          ),
    profile: json['profile'] == null
        ? null
        : CockpitCaptureProfile.fromJson(json['profile']),
    allowFallback: json['allowFallback'] as bool?,
    cropLocator: cropLocatorJson == null
        ? null
        : CockpitLocator.fromJson(Map<String, Object?>.from(cropLocatorJson)),
  );
}