Electrocardiogram.fromJson constructor

Electrocardiogram.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory Electrocardiogram.fromJson(Map<String, dynamic> json) =>
    Electrocardiogram(
      uuid: json['uuid'] as String,
      start: DateTime.fromMillisecondsSinceEpoch(
        ((json['startTimestamp'] as double) * 1000).toInt(),
      ),
      end: DateTime.fromMillisecondsSinceEpoch(
        ((json['endTimestamp'] as double) * 1000).toInt(),
      ),
      sourceRevision:
          SourceRevision.fromJson(Map.from(json['sourceRevision'])),
      device: json['device'] != null
          ? Device.fromJson(Map.from(json['device']))
          : null,
      metadata: json['metadata'] != null ? Map.from(json['metadata']) : null,
      symptomsStatus: SymptomsStatus.values.firstWhere(
        (e) => e.code == json['symptomsStatus'],
      ),
      classification: Classification.values.firstWhere(
        (e) => e.code == json['classification'],
      ),
      numberOfVoltageMeasurements: json['numberOfVoltageMeasurements'] as int,
      averageHeartRate: json['averageHeartRate'] != null
          ? Map.from(json['averageHeartRate'])
          : null,
      samplingFrequency: json['samplingFrequency'] != null
          ? Map.from(json['samplingFrequency'])
          : null,
    );