dvai_bridge library

Classes

BoundServer
Result of a successful DVAIBridge.start call. Mirrors iOS BoundServer and Android BoundServer.
Commercial
Paid commercial license — the SDK runs without the "Powered by DVAI Bridge" badge.
CorsOrigin
CORS allow-origin policy for the embedded HTTP server. Mirrors the CorsOrigin shape on iOS / Android.
DeviceCapabilityHints
Coarse hardware hints used by the precheck heuristic.
DevModeDetection
Result of detectDevMode. Mirrors the JS-side { isDev: boolean; reason: string } shape.
DownloadOptions
Options for DVAIBridge.downloadModel.
DownloadResult
Result of a successful DVAIBridge.downloadModel call.
DVAIBridge
Public facade for the DVAIBridge Flutter plugin. Use the DVAIBridge.instance singleton:
DVAIBridgeState
Reactive view of the running bridge state, surfaced by DVAIBridge.instance.stateStream. Idiomatic Flutter consumers wrap this in StreamBuilder<DVAIBridgeState>, a Riverpod StreamProvider<DVAIBridgeState>, or a Bloc.
DvaiLicensePayload
Decoded license-payload shape we issue. Extra claims are tolerated; the validator only reads the ones below.
DvaiPublicKey
ES256 (P-256 ECDSA) public key in JWK form. Mirrors the JS-side DvaiPublicKeyJwk interface: every other DVAI-Bridge SDK consumes the same JWK shape so the same .jwt license file works across platforms.
FreeDev
Dev-mode bypass — the SDK proceeds without checking a license. The reason is surfaced via host-app dashboards.
FreeExpired
Had a valid license but exp is past. The validate() API returns this; validateAndAssert() THROWS LicenseRequiredException with a FreeExpired status attached.
FreeProd
Production deploy with no valid license. The validate() API returns this; validateAndAssert() THROWS LicenseRequiredException with a FreeProd status attached.
HardwareAssessment
v3.2 — JSON-serializable result of DVAIBridge.assessHardware.
LicenseStatus
Result of license validation. Discriminated sealed-class union so the consumer's decision tree is exhaustive (Commercial or Trial → premium; everything else → free).
LicenseValidator
Validate a DVAI-Bridge license once at SDK startup. The returned LicenseStatus is the discriminated value the rest of the SDK dispatches on. validate never throws on validation failure — it returns a FreeProd / FreeExpired status. validateAndAssert throws LicenseRequiredException for those statuses and is the BSL 1.1 enforcement point the public DVAIBridge.start uses.
LicenseValidatorOptions
Options accepted by LicenseValidator. Mirrors the JS-side LicenseValidatorOptions interface — extends the discovery options with key-registry overrides used by tests.
OffloadConfig
Distributed-inference configuration. Pass to StartOptions.offload to enable peer-to-peer offload of inference requests when the local device's hardware can't serve the model fast enough.
PairingRequest
A request for the consumer app to approve (or deny) pairing with a remote peer. Surfaced via DVAIBridge.pairingRequests; respond by calling PairingRequest.respond (or DVAIBridge.respondToPairingRequest with the id).
Peer
Peer dvai-bridge instance discovered on the LAN or via rendezvous. Mirrors the Peer shape on every other SDK 1:1.
ProgressEvent
One progress event from the native side. Both iOS and Android emit exactly this shape (see Phase 3F spec §3.5); the fields below are the union of every variant.
StartOptions
Options for DVAIBridge.start. Shape mirrors the iOS DVAIBridgeConfig and Android StartOptions 1:1, with backend required and the rest optional. Per-backend defaults match the underlying SDKs — see the per-platform docs for the full list.
StatusInfo
Read-only snapshot returned by DVAIBridge.status.
Trial
Trial license — same behaviour as Commercial, distinct only for audit + dashboard surfacing.

Enums

BackendKind
Inference backend selected via StartOptions.backend. The Dart API exposes the union of every backend supported by either platform.
CpuClass
CPU class buckets used by the heuristic.
DVAIBridgeErrorKind
Stable error-code surface mirrored by iOS DVAIBridgeError cases and Android DVAIBridgeError subclasses. Consumers switch on the DVAIBridgeError.kind field to react to failure modes.
DvaiPlatform
Platform identifiers the SDK recognises in license platforms claims. The wire format matches the JS-side enum string values exactly so the same JWT can activate multiple SDKs.
GpuClass
GPU class buckets used by the heuristic.
LogLevel
Log-verbosity hint for the iOS-side bridge. Ignored on Android (which has its own Log plumbing).
PeerVia
Discovery source a Peer was learned from.
PrecheckMode
Lifecycle mode the SDK would enter on start(). Returned by DVAIBridge.assessHardware. Matches the kebab-case enum values used on every other platform so cross-platform consumers see the same strings regardless of host.
ProgressKind
What happened. The native sides emit one event per phase transition.
ProgressPhase
Lifecycle phase a ProgressEvent relates to.

Constants

placeholderKid → const String
kid reserved for the placeholder key above. The validator refuses to accept tokens signed with this kid unless the caller explicitly opts in (allowPlaceholderKey: true passed to the LicenseValidator constructor). Used by tests and by the sample license printed by generate-keypair.mjs.
publicKeys → const Map<String, DvaiPublicKey>
Registry mapping kid → public key JWK.

Functions

isPaidTier(LicenseStatus status) bool
Returns true iff status represents a paid / unwatermarked tier.

Exceptions / Errors

AlreadyStartedError
Concrete DVAIBridgeErrorKind.alreadyStarted case.
BackendErrorError
Concrete DVAIBridgeErrorKind.backendError case.
BackendUnavailableError
Concrete DVAIBridgeErrorKind.backendUnavailable case.
ChecksumMismatchError
Concrete DVAIBridgeErrorKind.checksumMismatch case.
ConfigurationInvalidError
Concrete DVAIBridgeErrorKind.configurationInvalid case.
DownloadFailedError
Concrete DVAIBridgeErrorKind.downloadFailed case.
DVAIBridgeError
The single error type thrown across the public Dart surface of dvai_bridge. Sealed so consumers can exhaustively switch on concrete subtypes; kind mirrors the iOS / Android wire identifier.
LicenseRequiredException
Thrown by LicenseValidator.validateAndAssert when an SDK consumer attempts to run the library in a production / release context without a valid commercial or trial license.
ModelLoadFailedError
Concrete DVAIBridgeErrorKind.modelLoadFailed case.
NotStartedError
Concrete DVAIBridgeErrorKind.notStarted case.