DartBridge class
Central coordinator for all C++ bridges.
Matches Swift's CppBridge pattern exactly:
- 2-phase initialization (core sync + services async)
- Platform adapter registration (file ops, logging, keychain)
- Event callback registration
- Module registration coordination
Usage:
// Phase 1: Core init (sync, ~1-5ms)
DartBridge.initialize(SDKEnvironment.SDK_ENVIRONMENT_PRODUCTION);
// Phase 2: Services init (async, ~100-500ms)
await DartBridge.initializeServices();
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- auth → DartBridgeAuth
-
Authentication bridge
no setter
- device → DartBridgeDevice
-
Device bridge
no setter
- download → DartBridgeDownload
-
Download bridge
no setter
- embeddings → DartBridgeEmbeddings
-
Embeddings bridge
no setter
- environment → SDKEnvironment
-
Current environment
no setter
- events → DartBridgeEvents
-
Events bridge
no setter
- http → DartBridgeHTTP
-
HTTP bridge
no setter
- isInitialized → bool
-
Whether Phase 1 (core) initialization is complete
no setter
- lib → DynamicLibrary
-
Native library reference
no setter
- llm → DartBridgeLLM
-
LLM bridge
no setter
- lora → DartBridgeLora
-
LoRA adapter bridge
no setter
- loraRegistry → DartBridgeLoraRegistry
-
LoRA registry bridge
no setter
- modelLifecycle → DartBridgeModelLifecycle
-
Model lifecycle bridge
no setter
- modelPaths → DartBridgeModelPaths
-
Model assignment bridge
Model paths bridge
no setter
- modelRegistry → DartBridgeModelRegistry
-
Model registry bridge
no setter
- platform → DartBridgePlatform
-
Platform bridge (also exposes Foundation Models / System TTS/STT
availability callbacks via
DartBridgePlatform.registerServices()).no setter - rag → DartBridgeRAG
-
RAG pipeline bridge
no setter
- servicesInitialized → bool
-
Whether Phase 2 (services) initialization is complete
no setter
- state → DartBridgeState
-
State bridge
no setter
- storage → DartBridgeStorage
-
Storage bridge
no setter
- stt → DartBridgeSTT
-
STT bridge
no setter
- telemetry → DartBridgeTelemetry
-
Telemetry bridge
no setter
- tts → DartBridgeTTS
-
TTS bridge
no setter
- vad → DartBridgeVAD
-
VAD bridge
no setter
- vlm → DartBridgeVLM
-
VLM bridge
no setter
- voiceAgent → DartBridgeVoiceAgent
-
Voice agent bridge
no setter
Static Methods
-
beginShutdown(
) → void - Close the public facade immediately while an asynchronous reset drains Phase 1/2 work. Native owners remain alive until shutdown runs.
-
ensureServicesReady(
) → Future< void> -
Await Phase-2 completion before any work that requires services (HTTP,
auth, model-assignment, model-discovery). Mirrors Swift's
try? await ensureServicesReady()guard in RunAnywhere+ModelLifecycle.swift and RunAnywhere+Storage.swift. If Phase 1 has not run, throws SDKException.notInitialized; if the hook is not yet wired (very early call before initializeWithParams), returns immediately. -
initialize(
SDKEnvironment environment, {String apiKey = '', String baseURL = '', String deviceId = ''}) → void - Initialize the core bridge layer.
-
initializeServices(
{String? apiKey, String? baseURL, String? deviceId, String? buildToken, bool forceRefreshAssignments = false, bool flushTelemetry = true, bool discoverDownloadedModels = true, bool rescanLocalModels = true}) → Future< SdkInitResult?> - Initialize service bridges.
-
registerEnsureServicesReadyHook(
Future< void> hook()) → void - Register the Phase-2 readiness hook. Called once by RunAnywhere.initializeWithParams so capability files can invoke ensureServicesReady without importing runanywhere.dart.
-
shutdown(
) → Future< void> - Shutdown all bridges and release resources.