Skip to main content

Flutter SDK (Dart)

The Orbit Flutter SDK (orbit_flutter) brings three client surfaces to a single Dart codebase that targets iOS, Android, web, and desktop: video rooms (OrbitVideoRoom), in-app chat (OrbitChatClient — the same omnichannel conversation/inbox the web widget and native mobile SDKs use), and CDP analytics (OrbitCdpAnalytics — Segment-spec event ingestion over the same HMAC-signed ingest contract the web and Node SDKs use). These are client surfaces: chat authenticates with a publishable key (dv_live_pk_…), video rooms need no key at all (the token is minted server-side by your backend), and the CDP client uses a backend-injected ingest id and secret. Nothing here wraps the server-side management resources (messaging, voice, contacts, campaigns, verify) — those require a secret key and belong in your backend, via the Node SDK or the REST API. See Client / mobile SDKs (different scope, by design) on the SDK index.
Pre-publish — source-only. The Flutter SDK is not yet on pub.dev — dart pub add orbit_flutter fails today. Until first publish, depend on the source from the monorepo (packages/sdk-flutter/) via a path or git dependency.

Installation (pub)

Pre-publish, pin the source directly in pubspec.yaml:

Video rooms (OrbitVideoRoom)

Headless and engine-injected: your backend mints the room token server-side (POST /api/v1/video/rooms/:id/join) and hands the token plus server URL to the app. Wire a VideoRoomEngine over your WebRTC stack (for example livekit_client) — the package carries no hard WebRTC dependency.

In-app chat (OrbitChatClient)

The client is headless: it owns the conversation lifecycle, history, optimistic send, and the real-time inbound stream; your widget tree renders it. Each on… subscription returns an unsubscribe function.
Pass an OrbitChatStorage implementation to keep the conversation alive across app restarts — otherwise it lives only for the process lifetime. Call chat.dispose() during teardown to release the underlying HTTP resources.

CDP analytics (OrbitCdpAnalytics)

Stream Segment-spec track / identify / screen / page / group / alias / batch events into the Orbit Customer Data Platform. HMAC request signing happens inside the SDK boundary; the ingest id and secret are injected per session by your backend.

Error handling

  • Construction misuse fails fast: an empty or server-side secret key (dv_live_sk_… / dv_test_sk_…) passed to OrbitChatClient throws ArgumentError, because nothing bundled in a distributed binary stays secret.
  • CDP and chat API failures surface as typed exceptions — OrbitCdpException / OrbitChatApiError — carrying the failure context; an oversized attachment also throws ArgumentError before any bytes leave the device. Subscribe to chat.onError for non-fatal errors from the background stream.
Only the publishable key (dv_live_pk_… / dv_test_pk_…) may ship inside the app. The CDP ingest secret is session-scoped and must come from your backend, never a compiled-in constant — the video room surface needs no key in the app at all.