VoicebotLauncher class final
Turnkey, all-in-one VoiceBot UI. Drop it once near the app root and it floats a VoiceButton over every screen, manages the ChatPanel (open/minimize/close), and owns the full client/session lifecycle.
VoicebotLauncher(
client: VoicebotClient.init(baseUrl: '…', tokenProvider: …),
onClientReady: (c) => c.registerToolHandler('add_to_cart', myHandler),
)
Lifecycle (HANDOFF §4): tapping the button opens a session and the panel; the
panel's minimize collapses to the button while the session stays alive
(no end); the panel's close (X) calls endSession() for a real teardown.
The button + panel float above all routes via an OverlayEntry inserted into the nearest root Overlay. For custom layouts, use VoiceButton and ChatPanel directly instead.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- VoicebotLauncher
Constructors
- VoicebotLauncher({required VoicebotClient client, SessionConfig config = const SessionConfig(), VoicebotTheme? theme, void onClientReady(VoicebotClient client)?, void onSessionStarted(VoicebotSession session)?, bool disposeClientOnUnmount = true, Widget? child, Key? key})
-
const
Properties
- child → Widget?
-
Optional subtree to render beneath the floating UI. When provided, this
widget paints child and overlays the launcher above it; when null it
renders nothing of its own (it only manages the overlay) — drop it inside
a tree that already has a Navigator/Overlay.
final
- client → VoicebotClient
-
The configured client. Handlers/deep-links can be registered here, on
onClientReady, or before passing it in.
final
- config → SessionConfig
-
Session tuning used when the assistant is opened (voice vs text, lang, …).
final
- disposeClientOnUnmount → bool
-
Tear down the client (and any session) when this widget unmounts. Set
false if you own the client elsewhere and reuse it.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onClientReady → void Function(VoicebotClient client)?
-
Called once after mount with the client — a convenient spot to register
tool handlers / deep-link maps.
final
- onSessionStarted → void Function(VoicebotSession session)?
-
Called each time a new VoicebotSession is opened (e.g. to wire
updateContext/sendCartEventto your navigation/cart).final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- theme → VoicebotTheme?
-
Theme for the floating button + panel; falls back to
VoicebotThemeProvider then defaults.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< VoicebotLauncher> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited