getNameOwner method

Future<String?> getNameOwner(
  1. String name
)

Returns the unique connection name of the client that owns name.

Implementation

Future<String?> getNameOwner(String name) async {
  DBusMethodSuccessResponse result;
  try {
    result = await callMethod(
        destination: 'org.freedesktop.DBus',
        path: DBusObjectPath('/org/freedesktop/DBus'),
        interface: 'org.freedesktop.DBus',
        name: 'GetNameOwner',
        values: [DBusString(name)],
        replySignature: DBusSignature('s'));
  } on DBusMethodResponseException catch (e) {
    if (e.response.errorName == 'org.freedesktop.DBus.Error.NameHasNoOwner') {
      return null;
    }
    rethrow;
  }
  return result.returnValues[0].asString();
}