getValue method

bool getValue()

Reads the value of the line (active / inactive)

Throws a StateError if the line is not requested.

If the line is in output mode, the last written value using setValue will be returned. If setValue was never called, the initialValue given to request or release will be returned.

If direction == LineDirection.input this will obtain a fresh value from the platform side.

Implementation

bool getValue() {
  if (_requested == false) {
    throw StateError("Can't get line value because line is not requested.");
  }

  if (_info!.direction == LineDirection.input) {
    return PlatformInterface.instance.getLineValue(_lineHandle);
  } else {
    return _value!;
  }
}