RecordMetrics.fromJson constructor

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

Deserializes a JSON-compatible map to create a RecordMetrics instance.

Used internally by recorder and log APIs. The expected map structure may change without notice.

Implementation

factory RecordMetrics.fromJson(final Map<String, dynamic> json) {
  return RecordMetrics(
    distanceMeters: (json['distanceMeters'] ?? 0.0).toDouble(),
    elevationGainMeters: (json['elevationGainMeters'] ?? 0.0).toDouble(),
    avgSpeedMps: (json['avgSpeedMps'] ?? 0.0).toDouble(),
  );
}