dbus 0.6.3
dbus: ^0.6.3 copied to clipboard

A native Dart implementation of the D-Bus message bus client. This package allows Dart applications to directly access services on the Linux desktop.

example/example.dart

import 'package:dbus/dbus.dart';

void main() async {
  var client = DBusClient.session();
  var object = DBusRemoteObject(client,
      name: 'org.freedesktop.Notifications',
      path: DBusObjectPath('/org/freedesktop/Notifications'));
  var values = [
    DBusString(''), // App name
    DBusUint32(0), // Replaces
    DBusString(''), // Icon
    DBusString('Hello World!'), // Summary
    DBusString(''), // Body
    DBusArray(DBusSignature('s')), // Actions
    DBusDict(DBusSignature('s'), DBusSignature('v')), // Hints
    DBusInt32(-1), // Expire timeout
  ];
  try {
    var result = await object.callMethod(
        'org.freedesktop.Notifications', 'Notify', values,
        replySignature: DBusSignature('u'));
    var id = result.returnValues[0];
    print('notify ${id.toNative()}');
  } on DBusServiceUnknownException {
    print('Notification service not available');
  }
  await client.close();
}
23
likes
120
pub points
99%
popularity

Publisher

canonical.com

A native Dart implementation of the D-Bus message bus client. This package allows Dart applications to directly access services on the Linux desktop.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MPL-2.0 (LICENSE)

Dependencies

args, ffi, meta, pedantic, xml

More

Packages that depend on dbus