ScenePalette.fromJson constructor
Creates a ScenePalette object from the JSON response to a GET request.
Implementation
factory ScenePalette.fromJson(Map<String, dynamic> dataMap) {
return ScenePalette(
colors: (dataMap[ApiFields.color] as List<dynamic>?)
?.map((color) => ScenePaletteColor.fromJson(color))
.toList() ??
[],
dimmings: (dataMap[ApiFields.dimming] as List<dynamic>?)
?.map((d) => LightDimming.fromJson(d))
.toList() ??
[],
colorTemperatures: (dataMap[ApiFields.colorTemperature] as List<dynamic>?)
?.map((ct) => ScenePaletteColorTemperature.fromJson(ct))
.toList() ??
[],
);
}