SDK (preview)
A preview of the planned Flutter SDK that will wrap the ker-ai API. The SDK is not yet published — integrate against the API directly for now.
Not yet published. The Flutter SDK described here is planned but not released. Today, integrate against the API directly — see Getting started. This page previews the shape the SDK will take so you can plan ahead; names and details may change before launch.
The SDK's public surface will be intentionally small: a widget, a config object, a tool registry, and a controller. Everything is plain Dart — no state-management library leaks through, so the SDK fits whatever your app already uses.
VoiceAssistant
The widget you place on screen. It renders the embedded mic button and the transcript sheet, and owns the session lifecycle.
VoiceAssistantConfig
Configures a session. Only a few fields are required; the rest have sensible defaults.
| Field | Required | Purpose |
|---|---|---|
endpoint | yes | Base URL of your ker-ai backend. |
apiKey | yes | Your backend key (pass via --dart-define). |
language | yes | BCP-47 tag, e.g. ml-IN. |
mode | no | clientText (default) or serverAudio. See modes. |
tools | no | A ToolRegistry of functions ker-ai may call. |
systemPrompt | no | Override the assistant's instructions. |
temperature | no | Sampling temperature for the model. |
Registering tools
A Tool is a named function with a typed parameter schema and a handler. ker-ai
decides when to call it from the user's speech; your handler does the work and
returns JSON-serializable data that the assistant speaks back.
Guidelines that make tool calls reliable:
- Write the
descriptionfor the model, not for yourself — say when to use it. - Keep parameters flat and typed. Mark optional ones with a
defaultValue. - Return small, structured results. The model speaks a summary, so it does not need your whole database row.
The controller
For programmatic control — start/stop listening, push app context, or react to
session state — pass a VoiceAssistantController.
The controller exposes plain Streams and methods. There are no framework types
in the signatures, so you can bridge it to Riverpod, Bloc, setState, or
anything else.
Surfacing recommendations
Beyond reacting to speech, ker-ai can proactively suggest actions from your app's state. Provide a snapshot and ker-ai surfaces relevant nudges through the same widget.
See recommendations for how snapshots are pulled and turned into suggestions.
Error handling
The SDK reports user-actionable failures — microphone permission denied, an
unsupported browser speech API, a dropped connection, an invalid config — through
onError and the controller's error state, each with a readable message. Show
them; don't swallow them.