DurbunClient class

Implemented types

Properties

app → DetectedApp
final
appSessionId → String?
Server-assigned app session id (null until connected once).
no setter
captureBodies → bool
no setteroverride
config → SdkConfig
Config from the desktop (defaults until the first welcome).
no setter
configKnown → bool
Whether a welcome/config was received at least once.
no setter
connection → DurbunConnection
no setter
connectionChanges → Stream<DurbunConnection>
no setter
device → DetectedDevice
final
extraCapabilities → List<String>
final
hashCode → int
The hash code for this object.
no setterinherited
hasNative → bool
Whether a native layer is attached.
no setter
isConnected → bool
no setter
isDisposed → bool
no setter
maxBodyBytes → int
no setteroverride
mocks → List<MockRule>
Mock rules of the connected desktop (empty while disconnected).
no setter
mocksReady → Future<void>?
Requests wait only while a peer has accepted the connection and the welcome (with its mock rules) is on its way. Without a desktop — no listener, hello still held back, nothing accepted yet — they never wait; DurbunOptions.waitForDesktop is the explicit way to wait longer.
no setteroverride
networkEnabled → bool
False → the wrapper is a pure pass-through (SDK disabled or disposed).
no setteroverride
options → DurbunOptions
final
outgoingTap ↔ void Function(Map<String, Object?> message)?
Sees every outgoing message (Dart and native-encoded lines) before the transport: the in-app inspector keeps its own copy. Must not throw or mutate the message.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sdkPlatform → String
final
session → String
Random id for this app launch (hello.session).
final
usesBackgroundIsolate → bool
Whether the transport engine runs on a background isolate.
no setter

Methods

addAction(DurbunAction action) → void
Adds (or replaces) an action shown on the desktop.
addActions(Iterable<DurbunAction> actions) → void
Adds several actions with a single hello/actions refresh.
addConfigListener(void listener(SdkConfig config)) → void
addStateListener(void listener()) → void
Called whenever connection, config, mocks or hello change.
attachNative(NativePart part) → void
Joins the native layer (Kotlin / Swift core hosted by the Flutter plugin) to this session: its capabilities, actions and app info go into hello, its commands are forwarded to it. Replaces a previous part.
debugHello() → Map<String, Object?>
The hello message as it is sent (for diagnostics and tests).
describeActions() → List<Map<String, Object?>>
describeState() → Map<String, Object?>
Current desktop state as one JSON-like map (for the native layer): {connected, via, appId, config, mocks, hello}.
dispose({Duration flushTimeout = Duration.zero}) → Future<void>
Stops the SDK: closes the connection, removes the HTTP overrides.
event(String name, [Map<String, Object?>? props]) → void
Sends a custom event (SdkEvent). Never throws.
flush([Duration timeout = const Duration(seconds: 5)]) → Future<bool>
Waits until everything logged so far was handed to the desktop's socket (useful before a CLI program exits). False on timeout / no connection.
isRedactedHeader(String lowerCaseName) → bool
Whether the value of lowerCaseName must be redacted.
override
log(DurbunLogLevel level, Object? message, {String? tag, Object? data, Object? error, StackTrace? stackTrace, String? kind, double? ts}) → void
Sends an app log (SdkLog). Never throws.
matchMock(String method, String url) → MockRule?
First matching mock rule for this request, or null.
override
metric(Map<String, Object?> metricMessage) → void
Sends a metric sample. While disconnected only outgoingTap (the in-app inspector) sees it: nothing waits for the desktop.
nextRequestId() → String
Unique request id within this app session.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
publishActions() → void
Re-sends action descriptors (current values) and refreshes the hello.
registerCommand(String name, DurbunCommandHandler handler) → void
Registers a command that is not shown as an action.
removeAction(String id) → void
removeConfigListener(void listener(SdkConfig config)) → void
removeStateListener(void listener()) → void
runInternal<R>(R body()) → R
Runs body in the SDK's internal zone (errors are swallowed).
sendEncoded(String jsonLine) → void
Sends a message the native layer already encoded as one JSON object (no trailing newline). It shares this client's buffer and connection.
sendLog({required DurbunLogLevel level, required String message, String? tag, Object? data, Map<String, Object?>? error, String? kind, double? ts}) → void
Lower-level variant of log taking a ready ErrorInfo map.
sendNetMessage(Map<String, Object?> message) → void
Queues a net.* message.
override
startPeriodicTimer(Duration period, void callback()) → Timer
Periodic timer in the internal zone.
startTimer(Duration duration, void callback()) → Timer
Starts a timer outside the app's zones.
override
toString() → String
A string representation of this object.
inherited
updateNativeActions(List<Map<String, Object?>> actions) → void
The native layer's action list changed (values or entries).
waitForConnection(Duration timeout) → Future<bool>
Waits for a connection (or timeout); true when connected.

Operators

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

Static Properties

current → DurbunClient?
The running client on this isolate, if any.
no setter

Static Methods

diagnostic(String message) → void
SDK-internal diagnostics (debug level: IDE / DevTools console only).
errorInfo(Object? error, StackTrace? stackTrace) → Map<String, Object?>?
ErrorInfo for an error object / stack trace (null when both absent).
start(DurbunOptions options, {String sdkPlatform = 'flutter', List<String> extraCapabilities = const <String>[], TransportConfig? transportConfig, Future<void>? helloGate}) → DurbunClient
Starts the SDK on this isolate (synchronous; the connection is made in the background). Returns the already running client if there is one.

Constants

kHelloGateTimeout → const Duration
Longest time the first hello waits for start's helloGate: as long as the Flutter glue waits for the plugin's native start, so a slow native layer still makes it into the session (the server keeps the first hello of a connection).