updateLeds method

void updateLeds(
  1. int deviceId,
  2. int numColors,
  3. Color color
)

Updates all LEDs with one color.

Implementation

void updateLeds(int deviceId, int numColors, Color color) {
  if (deviceId >= _controllerCount) {
    throw Exception('Device index out of range!');
  }
  final bb = BytesBuilder();
  bb.add(Uint8List(4)..buffer.asByteData().setUint32(0, 0, Endian.little));
  bb.add(numColors.toUint16Bytes());
  final colorBytes = color.toBytes();
  for (int i = 0; i < numColors; i++) {
    bb.add(colorBytes);
  }
  _send(
    CommandId.updateLeds,
    bb.toBytes(),
    deviceId: deviceId,
  );
}