Motion.fromJSON constructor

Motion.fromJSON(
  1. Map<String, dynamic> data
)

Implementation

factory Motion.fromJSON(Map<String, dynamic> data) => Motion(
      numberOfSteps: data['numberOfSteps'] ?? 0,
      floorsAscended: data['floorsAscended'] ?? 0,
      floorsDescended: data['floorsDescended'] ?? 0,
      distance: data['distance'] ?? 0,
      startDate: DateTime.fromMillisecondsSinceEpoch(
          ((data['startDate'] as num?) ?? 0.0).toInt()),
      endDate: DateTime.fromMillisecondsSinceEpoch(
          ((data['endDate'] as num?) ?? 0.0).toInt()),
      averageActivePace: data['averageActivePace'] ?? 0,
      currentPace: data['currentPace'] ?? 0,
    );