setValue method

void setValue(
  1. bool value
)

Sets the value of the line to active (true) or inactive (false).

Throws a StateError if the line is not requested as output.

Implementation

void setValue(bool value) {
  ArgumentError.checkNotNull(value, "value");

  if (_requested == false) {
    throw StateError("Can't set line value because line is not requested and configured as output.");
  }

  if (_info!.direction != LineDirection.output) {
    throw StateError("Can't set line value because line is not configured as output.");
  }

  if (_value == value) return;

  PlatformInterface.instance.setLineValue(_lineHandle, value);

  _value = value;
}