start static method
DurbunClient
start(
- DurbunOptions options, {
- String sdkPlatform = 'flutter',
- List<
String> extraCapabilities = const <String>[], - TransportConfig? transportConfig,
- Future<
void> ? helloGate,
Starts the SDK on this isolate (synchronous; the connection is made in the background). Returns the already running client if there is one.
extraCapabilities are advertised on top of logs/events/commands and the
option-driven ones (the Flutter glue adds metrics).
helloGate: when given, the first hello is held back until it
completes (at most kHelloGateTimeout) so information that arrives
asynchronously — the native layer's capabilities, actions and app
version from the Flutter plugin — is already in it.
Implementation
static DurbunClient start(
DurbunOptions options, {
String sdkPlatform = 'flutter',
List<String> extraCapabilities = const <String>[],
TransportConfig? transportConfig,
Future<void>? helloGate,
}) {
final existing = _current;
if (existing != null && !existing._disposed) return existing;
late final DurbunClient client;
final zone = Zone.root.fork(
specification: ZoneSpecification(
handleUncaughtError: (self, parent, zone, error, stack) {
// Internal errors must never reach the app.
_diagnostic('internal error: $error');
},
),
);
zone.run(() {
final app = detectApp(
idOverride: options.appId,
nameOverride: options.appName,
versionOverride: options.appVersion,
);
final device = detectDevice();
client = DurbunClient._(
options: options,
sdkPlatform: sdkPlatform,
app: app,
device: device,
extraCapabilities: extraCapabilities,
zone: zone,
);
_current = client;
client._start(transportConfig, helloGate);
});
return client;
}