VooWatchHealthSample.fromJson constructor

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

Implementation

factory VooWatchHealthSample.fromJson(Map<String, Object?> json) => VooWatchHealthSample(
  metric: VooWatchHealthMetric.values.firstWhere((m) => m.name == json['metric']),
  value: (json['value']! as num).toDouble(),
  unit: json['unit']! as String,
  timestamp: DateTime.fromMillisecondsSinceEpoch(json['timestamp']! as int, isUtc: true),
);