DurbunClient class
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.
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.
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' , 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).