zenoh_dart 0.30.0 copy "zenoh_dart: ^0.30.0" to clipboard
zenoh_dart: ^0.30.0 copied to clipboard

Dart bindings for Zenoh, the pub/sub/query protocol, via FFI to zenoh-c 1.8.0. Linux and Android.

example/example.dart

import 'dart:io';

import 'package:zenoh_dart/zenoh.dart';

Future<void> main() async {
  Zenoh.initLog('error');

  // Open a zenoh session in peer mode (default). Guarded the way canon's
  // examples guard it -- report and exit, rather than letting the failure
  // present as an unhandled exception. The guard is inline here because this
  // file is the package showcase, not one of the canon-mirroring `z_*`
  // examples, and so does not take the shared `common_args.dart` block.
  final Session session;
  try {
    session = await Session.open();
  } on ZenohException {
    print('Unable to open session!');
    exit(255);
  }

  try {
    session
      // Put a value on a key expression
      ..put('demo/example/greeting', 'Hello from Dart!')
      // Delete a resource
      ..deleteResource('demo/example/greeting');
  } finally {
    // Always release the native resources held by the session
    session.close();
  }
}
3
likes
150
points
143
downloads

Documentation

API reference

Publisher

verified publisherbluecorn.dev

Weekly Downloads

Dart bindings for Zenoh, the pub/sub/query protocol, via FFI to zenoh-c 1.8.0. Linux and Android.

Repository (GitHub)
View/report issues

Topics

#zenoh #ffi #pubsub #networking #robotics

License

Apache-2.0 (license)

Dependencies

args, code_assets, ffi, hooks, meta

More

Packages that depend on zenoh_dart