Dart / Flutter SDK
kalam_link is the official KalamDB client for Dart and Flutter. It wraps the
compiled Rust core via Flutter Rust Bridge v2, giving you native-speed queries
and live subscriptions with a simple Dart API.
Status: This SDK is in beta and may still change between releases.
What you can do
kalam_link currently focuses on the core app-client workflows:
- Execute SQL over HTTP (
query) - Open any
SELECTquery live over WebSocket (liveEvents) - Consume reconciled materialized live rows (
live,liveTable) - Authenticate with JWT, user/password bootstrap, or anonymous access (
authProvider,login,refreshToken,refreshAuth) - Observe connection lifecycle (
connectionHandlers) - Inspect active subscriptions (
getSubscriptions) - Control the shared WebSocket explicitly (
isConnected,disconnectWebSocket,reconnectWebSocket)
The current Dart SDK does not expose Topic consumer / ACK worker APIs.
Installation
Add to your pubspec.yaml:
dependencies:kalam_link: ^0.5.2-rc.1Then run:
Initialization
Call KalamClient.init() once at app startup before creating any clients:
Quick start
For liveEvents() and materialized live-query APIs, keep the SQL strict: SELECT ... FROM ... WHERE .... Do not include ORDER BY or LIMIT inside the live SQL.
Recommended reading order
- Setup & Quick Start
- Authentication
- Auth-Aware Client
- Querying & DML
- Realtime Subscriptions
- Client Lifecycle
- Types & Models
- Server Setup & Diagnostics Boundary
Supported platforms
This package is a Flutter FFI plugin (via Flutter Rust Bridge) and is configured for:
- Android, iOS
- macOS, Windows, Linux
Notes
- Call
KalamClient.init()exactly once at startup. - Prefer
authProviderfor expiring tokens. - Cancel live streams by cancelling your
StreamSubscription. - Use
liveEvents()for realtime SQL change streams. - Prefer
live()orliveTable()when your UI wants the latest reconciled row list. - Use
getSubscriptions()andSeqIdif you need resume-aware client bookkeeping. - Native Dart subscriptions use MessagePack by default on the shared Rust transport.
Connection options
| Parameter | Type | Default | Description |
|---|---|---|---|
url | String | required | Server URL |
authProvider | AuthProvider | Auth.none() | Async callback for fresh credentials (recommended) |
disableCompression | bool | false | Disable WS compression — dev only |
wsLazyConnect | bool | true | Defer WebSocket connect until the first live stream |
timeout | Duration | 30s | HTTP request timeout |
maxRetries | int | 3 | Retry count for idempotent queries |
connectionHandlers | ConnectionHandlers? | — | Lifecycle event callbacks |
keepaliveInterval | Duration? | server default | WS keepalive ping interval |
logLevel | Level? | Level.warning | SDK logging threshold (logger package level) |
logListener | LogListener? | — | Redirect SDK logs to your own logger/sink |
authProviderMaxAttempts | int | 3 | Retry attempts for transient auth callback failures |
authProviderInitialBackoff | Duration | 250ms | Initial auth retry backoff |
authProviderMaxBackoff | Duration | 2s | Maximum auth retry backoff |
SDK logging
The Dart SDK uses Level from package:logger/logger.dart for log severity.
When logListener is not set, the SDK falls back to print(...), which is visible in Flutter/Android consoles.