ai_sdk_flutter_ui 1.2.0
ai_sdk_flutter_ui: ^1.2.0 copied to clipboard
Flutter UI controllers and prebuilt widgets for the AI SDK Dart port.
1.2.0 #
Turns ai_sdk_flutter_ui into a one-stop Flutter UI hub: prebuilt widgets, hardened controllers,
and full test coverage.
Visual design #
- Reworked the widget set toward a restrained Material 3 look: a bubbleless assistant transcript
(user turns keep a bubble; assistant turns are plain text with a subtle marker), a shared motion +
haptics vocabulary (
AiMotion, built only from core Flutter primitives — no animation dependency), gentle ease-out curves over bounce, and a first-class reduced-motion path. The design system is documented inDESIGN.md.
Prebuilt widget library (new) #
19 composable, themeable Material widgets that read only the controllers' public state and
Theme.of(context). No heavy platform dependencies — attachment rendering and link-opening are
exposed as callbacks.
Scaffolding & message list
AiChatScaffold— drop-in chat body (ChatMessageList+ChatComposer) wired to aChatController+ToolLoopAgent.ChatMessageList— renders message history + an optimistic streaming bubble; auto-scrolls; optionalmessageBuilder.ChatMessageBubble— a single message styled by role, with selectable text.AssistantMessageView— a rich assistant turn composing text, reasoning, tool calls, sources, and media together.MessageMedia/MessageImage/MessageAttachment— render image and file attachments on a message, with anonOpencallback.MessageActionsBar— a per-message action row (copy, retry, …) with callbacks.
Streaming & status
StreamingTextView— streaming text with a subtle blinking cursor.TypingIndicator— animated "assistant is typing" dots.UsageView— a compact token-usage summary (prompt / completion / total).
Reasoning, tools & sources
ReasoningView— a collapsible panel for reasoning / "thinking" text.ToolCallCard— a tool call (name + pretty-printed JSON args) and its result/error.ToolApprovalCard— approve/reject UI for tools gated byneedsApproval.SourceCitations— a wrap of citation chips for source parts, with anonTapcallback.
Input & navigation
ChatComposer— text field + send button; disabled while loading; optionalonStop/onAttach.PromptSuggestions— tappable starter-prompt chips.ScrollToBottomButton— appears when the list is scrolled up; jumps to the latest message.ChatErrorView— an inline error banner with a retry callback.
Object streaming
ObjectStreamView— renders anObjectStreamController's partial JSON as it streams.
Controller improvements #
ObjectStreamController— added auseObject-style convenience: passmodel/schemato the constructor and callsubmit(prompt), which runsstreamText(output: Output.object(schema:))and binds the partial-output stream.bind(Stream<T>)is still available for full flexibility.submitthrows a clearStateErrorifmodel/schemaare missing.ChatController— added anisStreaminggetter (status == ChatStatus.streaming) for consistency withCompletionControllerandObjectStreamController.ChatControllerandCompletionControllernow surface streaming errors. Errors raised during astreamTextrun arrive on the full event stream rather than the text stream; both controllers now watch it, soerror/onError(andChatStatus.error) fire on streaming failures, not just setup failures. Subscriptions are cleaned up onstop/clear/dispose.
Tests #
- Added the package's first test suite: 133 tests (controller + widget) covering state
transitions,
streamingContent,append/reload/clear/stop,onFinish/onError,isStreaming,ObjectStreamController.submit/bind, and atestWidgetspass for every widget. 99.5% line coverage.
Fixes #
PressableScaleno longer throws when disposed after being built under reduced motion. Its animation controller is now created ininitStateinstead of lazily inbuild, so tearing the widget down (when it never built the animated path) no longer constructs aTickeragainst a defunct element ("Looking up a deactivated widget's ancestor is unsafe").
1.1.0 #
- Bumped
ai_sdk_dartconstraint to^1.1.0to pick uptimeout,onAbort, and all other 1.1.0 core improvements. - No controller-level behaviour changes; version aligned with the rest of the monorepo.
1.0.0+1 #
- Improved pubspec descriptions for better pub.dev discoverability.
- Added
example/example.mdwith usage examples and links to runnable apps.
1.0.0 #
First stable release. Package renamed from ai_sdk_flutter → ai_sdk_flutter_ui to avoid conflicts with existing pub.dev packages. Depends on ai_sdk_dart 1.0.0.
ChatController— manages a chat message list, streams assistant replies, handles optimistic UI updates. ImplementsListenablefor use withListenableBuilder.CompletionController— single-turn text completion with streaming and status tracking.ObjectStreamController<T>— streams partial structured objects, providing live partial updates as JSON arrives.- Full hook parity with Vercel AI SDK v6 React hooks:
append,reload,clear/reset,isStreaming,onFinish,onError.
0.2.0 #
- Initial release.
ChatController— manages a chat message list, streams assistant replies, handles optimistic UI updates.CompletionController— single-turn text completion with streaming support.ObjectStreamController— streams partial structured objects with live UI updates.- Full hook parity:
append,reload,clear/reset,isStreaming,onFinish,onError.