getProperty method

Future<DBusValue> getProperty(
  1. String interface,
  2. String name, {
  3. DBusSignature? signature,
})
inherited

Gets a property on this object.

If signature is provided this causes this method to throw a DBusPropertySignatureException if a property is returned that does not match the provided signature.

Throws DBusServiceUnknownException if there is the requested service is not available. Throws DBusUnknownObjectException if this object is not available. Throws DBusUnknownInterfaceException if properties are not supported by this object. Throws DBusUnknownPropertyException if the property doesn't exist. Throws DBusPropertyWriteOnlyException if the property can't be read.

Implementation

Future<DBusValue> getProperty(String interface, String name,
    {DBusSignature? signature}) async {
  var result = await client.callMethod(
      destination: this.name,
      path: path,
      interface: 'org.freedesktop.DBus.Properties',
      name: 'Get',
      values: [DBusString(interface), DBusString(name)],
      replySignature: DBusSignature('v'));
  var value = result.returnValues[0].asVariant();
  if (signature != null && value.signature != signature) {
    throw DBusPropertySignatureException('$interface.$name', value);
  }
  return value;
}