LightSignalingStatus.fromJson constructor

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

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

Implementation

factory LightSignalingStatus.fromJson(Map<String, dynamic> dataMap) {
  return LightSignalingStatus(
    signal: dataMap[ApiFields.signal] ?? "",
    signalValues: List<String>.from(dataMap[ApiFields.signalValues] ?? []),
    estimatedEnd: DateTime.tryParse(dataMap[ApiFields.estimatedEnd] ?? "") ??
        DateUtils.dateOnly(DateTime.now()),
  );
}