SceneActionAction.fromJson constructor

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

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

Implementation

factory SceneActionAction.fromJson(Map<String, dynamic> dataMap) {
  return SceneActionAction(
      on: LightOn.fromJson(
          Map<String, dynamic>.from(dataMap[ApiFields.isOn] ?? {})),
      dimming: LightDimming.fromJson(
          Map<String, dynamic>.from(dataMap[ApiFields.dimming] ?? {})),
      xy: LightColorXy.fromJson(
          Map<String, dynamic>.from(dataMap[ApiFields.color] ?? {})),
      colorTemperature: LightPowerUpColorColorTemperature.fromJson(
          Map<String, dynamic>.from(
              dataMap[ApiFields.colorTemperature] ?? {})),
      gradient: LightGradient.fromJson(
          Map<String, dynamic>.from(dataMap[ApiFields.gradient] ?? {})),
      effect: Map<String, dynamic>.from(
              dataMap[ApiFields.effects] ?? {})[ApiFields.effect] ??
          "",
      durationMilliseconds: Map<String, dynamic>.from(
          dataMap[ApiFields.dynamics] ?? {})[ApiFields.duration]);
}