Config class

A Zenoh configuration.

Wraps z_owned_config_t. Use the default constructor for default configuration, then call insertJson5 to customise settings.

Must be disposed when no longer needed to release native memory. If passed to Session.open, the config is consumed and must not be reused or disposed by the caller.

This object holds a native handle, so it cannot cross an isolate boundary: a copy would share this one's native address while carrying its own fresh disposal flag, and the second release would be a use-after-free. Sending it throws ArgumentError naming the class.

It carries a NativeFinalizer safety net: if it is dropped without an explicit release, its native resources are reclaimed when the object is collected. ⛔ The net is not a substitute for releasing it explicitly — a finalizer runs at an unpredictable time, or not at all if the program exits first.

Implemented types

Constructors

Config()
Creates a default Zenoh configuration.
Config.fromEnv()
Creates a configuration from the ZENOH_CONFIG environment variable.
factory
Config.fromFile(String path)
Creates a configuration from a JSON5 file at path.
factory
Config.fromStr(String json)
Creates a configuration from a JSON5 json string.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
nativePtr Pointer<Void>
Internal: returns the native pointer for use by Session.open.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → void
Releases native resources held by this configuration.
get(String key) String
Returns the JSON value at key.
insertJson5(String key, String value) → void
Inserts a JSON5 value at the given configuration key path.
markConsumed() → void
Internal: called by Session.open / Zenoh.scout after the config has been moved into zenoh-c via z_config_move.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
Returns this configuration as a JSON string.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited