ScenarioRunStep.fromJson constructor

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

Implementation

factory ScenarioRunStep.fromJson(Map<String, Object?> json) =>
    ScenarioRunStep(
      index: _int(json['index'], 0),
      position: json['position'] as String? ?? '',
      parent: json['parent'] as int?,
      branch: json['branch'] as String?,
      name: json['name'] as String?,
      auto: json['auto'] == true,
      tags: _stringList(json['tags']),
      // Absent means `screen`, which is what every report written before
      // there was anything else to be holds — and what almost every step of
      // every report since holds too.
      kind: switch (json['kind']) {
        'document' => ScenarioStepKind.document,
        'notification' => ScenarioStepKind.notification,
        'setup' => ScenarioStepKind.setup,
        _ => ScenarioStepKind.screen,
      },
      image: json['image'] as String?,
      format: json['format'] as String?,
      width: json['width'] as int?,
      height: json['height'] as int?,
      tree: json['tree'] as String?,
      file: json['file'] as String?,
      mimeType: json['mimeType'] as String?,
      bytes: json['bytes'] as int?,
      ms: json['ms'] as int?,
      notification: switch (json['notification']) {
        Map notification => ScenarioNotification(
          body: '${notification['body'] ?? ''}',
          title: notification['title'] as String?,
          appName: notification['appName'] as String?,
        ),
        _ => null,
      },
      keys: json['keys'] as String?,
      semantics: json['semantics'] as String?,
      texts: _stringList(json['texts']),
      address: json['address'] as String? ?? '',
      statusBrightness: json['statusBrightness'] as String?,
      navBrightness: json['navBrightness'] as String?,
      verb: json['verb'] as String?,
      target: json['target'] as String?,
      aim: ScenarioAim.fromJson(json['aim']),
      events: json['events'] as String?,
      eventCount: json['eventCount'] as int?,
      eventChannels: switch (json['eventChannels']) {
        Map channels => {
          for (var entry in channels.entries)
            '${entry.key}': _int(entry.value, 0),
        },
        _ => null,
      },
      eventTitles: switch (json['eventTitles']) {
        List titles => [for (var title in titles) '$title'],
        _ => null,
      },
      eventsDropped: json['eventsDropped'] as int?,
      frames: json['frames'] as String?,
      frameCount: json['frameCount'] as int?,
      frameWidth: json['frameWidth'] as int?,
      frameHeight: json['frameHeight'] as int?,
      frameIntervalMs: json['frameIntervalMs'] as int?,
      framesDropped: json['framesDropped'] as int?,
      settled: json['settled'] as bool? ?? true,
      waited: json['waited'] as bool? ?? true,
      landed: json['landed'] as bool? ?? true,
      guessed: json['guessed'] as int?,
      stillTicking: [
        for (var line in json['stillTicking'] as List? ?? const [])
          if (line is String) line,
      ],
      digest: json['digest'] as String?,
      strayFrames: _int(json['strayFrames'], 0),
      keyboard: (json['keyboard'] as num?)?.toDouble(),
      unchanged: json['unchanged'] == true,
      failure: json['failure'] as String?,
    );