LightDynamics.fromJson constructor

LightDynamics.fromJson(
  1. Map<String, dynamic> dataMap
)

Creates a LightDynamics object from the JSON response to a GET request.

Implementation

factory LightDynamics.fromJson(Map<String, dynamic> dataMap) {
  return LightDynamics(
    status: dataMap[ApiFields.status] ?? "",
    statusValues: List<String>.from(dataMap[ApiFields.statusValues] ?? []),
    speed: ((dataMap[ApiFields.speed] ?? 0.0) as num).toDouble(),
    speedValid: dataMap[ApiFields.speedValid] ?? false,
    durationMilliseconds: dataMap[ApiFields.duration],
  );
}