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");

  //return _synchronizedRead(() async {
    if (/*!_requested ||*/ _info!= null && _info?.direction != LineDirection.output) {
      throw StateError(
          "Can't set line value because line is not configured as output.");
    }

    if (_value == value) return;

    _ProxyGpiodPlatformSide.setLineValue(_lineHandle, value);

    _value = value;
  //});
}