Flutter SDK reference
The public classes you use day to day, what each is for, and the one thing about it that surprises people.
The public API you use day to day. If you find yourself importing from src/, tell us what you needed and we will export it properly.
Full generated dartdoc lands on pub.dev with the first published release. This page is the map.
You rarely write these calls yourself: each task opens with the prompt that has your coding agent write them. This page is what they rely on.
Rendel
The facade. One init per app run.
| Member | Signature | Notes |
|---|---|---|
init | Future<void> init({required String appKey, RendelTheme? theme, RendelTheme? darkTheme, List<RendelAction> actions, RendelConfig config}) | Awaited. A key that does not start with rd_pk_, or is still an example's placeholder, asserts in debug and reports through onLog in release, then disables Rendel for the run — a typo used to cost a silent afternoon. darkTheme is drawn while the device is in dark mode; left out, it is derived from theme. See Dark mode. |
open | Future<void> open(BuildContext context) | Presents Rendel as a full-height sheet. While it is already up, or shrunk to the bubble after a screen it opened, it returns or restores that one rather than stacking a second (0.38). The first open after a relaunch opens on the last conversation when its last question was asked within the hour, by the same person, an answer that finished while the app was closed included (0.70.0). Returns without presenting when Rendel is disabled. |
close | void close(BuildContext context) | — |
openMemory | Future<void> openMemory(BuildContext context) | Opens "What I remember for you" as a sheet, for a link on your own settings or privacy screen. See Preference memory. Does nothing before init. |
openSupport | Future<bool> openSupport(BuildContext context, {String? thread}) | Opens the page where the person writes to your team, for your app's own "Contact us": the conversation they have, or, with none, a page whose first message starts one, so nobody who only looks leaves an empty conversation in your queue. Works while the assistant is paused too. While Support is off for this app, it opens only the conversation the person already has, so they read why it closed and how to reach you, and starts none. False, with nothing shown, when Support is off and they have none, or the conversation asked for with thread could not be read. With thread, that conversation of theirs, a sorted one as it was (0.77.0). From 0.97.0 the page says when your team is back on the person's own clock. While your team is answering them, someone without an email address keeps writing, with the request for one above the message box. A conversation closed because you switched Support off says so, with your contact channels to tap and no message box; once you switch Support on again, they can write in it again like any sorted conversation. If too many conversations were started from one device or network in a short time, the page says so and the person's message waits to be sent again. |
supportStatus | ValueListenable<({bool open, int unread})> | Whether this person has a conversation with your team open, and how many of the team's lines wait unread: a dot on your own Ask button while one is open, the count while their reply waits (0.77.0). |
supportUnread | ValueListenable<int> | The team's lines this person has not read, for a badge on your own "Contact us". RendelLauncher shows it on itself. Read on init, on a push and when the support page closes. From 0.97.0 the same read brings any read of their account your team asked for, so it runs wherever they are in your app, and with userToken it tells Support whether the person is signed in, so your team is offered only the changes that can run as them. |
supportOn | bool | Whether the app has Support on, so you can show your "Contact us" only then. |
waiting | ValueListenable<RendelWaiting> | What waits for the person while the sheet is closed: answer (one finished unseen) or approval (a confirmation card), else none. RendelLauncher shows it as a dot; a button of your own listens here. Cleared when the sheet opens. |
reset | void reset() | Call on logout. Clears the conversation and the user, so the next turn is anonymous, and from 0.72.0 tells the server, so the person's follow-ups, inbox and push stop reaching this phone. Safe to call while the sheet is up. |
registerAction | void registerAction(RendelAction action) | Re-syncs the manifest. |
setCardSource | void setCardSource(String action, Future<String?> Function(Map<String, dynamic> params)? source) | The text an action's fullText parameter replaces, so its confirmation card can show the lines that change. Called with the card's parameters; null removes it. |
registerRoute | void registerRoute(String name, {required String title, required String description, Map<String, RendelRouteParam> params, required RendelRouteOpener open}) | A screen of your app Rendel may offer on a screens card. name is snake_case. title (1-60 characters) is your app's own name for the screen, drawn under the model's title. description (1-300) tells the model when it is the right screen. Up to 8 params, 50 routes per app. open runs your own navigation once the sheet is out of the way, with Rendel waiting in a bubble. Re-syncs the manifest. Safe before init. |
addContextProvider | void addContextProvider(String key, Future<Map<String, dynamic>> Function() provider) | Called per turn, with a 300 ms budget. A slow provider costs its own context, never the turn. |
identify | Future<void> identify({required String userId, Map<String, dynamic>? traits, String? userHmac}) | See Context. |
pair | Future<RendelPairResult> pair(String code) | Lets the console watch this device's conversation, read only, for two hours. Test keys only; a code works once, for ten minutes. Never throws: the result carries a sentence to show. Safe before init. On a test key, the same code sent as a message in Rendel pairs too, with no code of yours (0.82.0). See Pair a test app. |
followup | ValueListenable<RendelFollowup?> | The "In the app" follow-up waiting for this person, or null. RendelLauncher draws it, as a popup over itself or a banner across the top; an app with its own launcher listens here. See Follow-ups. |
followupCards | ValueListenable<List<RendelFollowup>> | The follow-ups waiting as cards at the top of the thread, whichever channel carried them: up to three (0.59.7). |
openFollowup | Future<bool> openFollowup(BuildContext context, {String? id}) | Opens the conversation the waiting follow-up is about, or the card id from followupCards. False when there is none, or it could not be loaded. |
dismissFollowup | void dismissFollowup([String? id]) | Puts the waiting follow-up away, or the card id; it is not shown again. |
handlePush | Future<bool> handlePush(BuildContext context, Map<String, dynamic> data) | Opens a tapped Rendel push on its conversation and returns true; false for a push that is not Rendel's, which your app handles. context is one below your navigator, as for open. rendel_push calls it for you. |
setPushToken | Future<void> setPushToken(String? token, {String? timezone, RendelApnsToken? apns, String? androidPackage}) | The device's push token, again on every refresh, and null when the person turns notifications off: a Firebase token, or with apns an iOS device token that Rendel sends straight to Apple (RendelApnsToken(environment: 'sandbox' | 'production', bundleId:, teamId:)). androidPackage names the Android app a Firebase token belongs to, so Settings › Push & email can say when that app is missing from your Firebase project. timezone is an IANA zone; without it the device's offset is sent. iOS and Android only. rendel_push calls it for you. |
pushFirebaseOptions | Future<Map<String, String>?> pushFirebaseOptions(String androidPackage) | The Firebase options Rendel read from your service account for this Android package; null while push is not set up. rendel_push starts Firebase with them on an app that has none of its own. |
navigatorObserver | NavigatorObserver | Add it to your navigator's observers and every screen the app shows is sent as a screen view. See Screen views and goals. |
setScreen | void setScreen(String? name) | Names the current page yourself, where the route's name says too little. The name stays with that page: going back to it brings the name back. null hands naming back to the route. |
track | void track(String name, [Map<String, dynamic> props = const {}]) | Counts something the person did, as an event with up to 20 flat properties. 'purchase': {'value': 549.9, 'currency': 'TRY', 'items': [...]}, with a value of 0 or more, a three-letter currency and at most 20 items; Follow-ups credits it to the follow-up the person last opened. A name marked as a goal in the console also counts as a goal: track('signup'), track('booking', {'value': 120, 'currency': 'TRY'}). Never throws; a malformed call is logged. |
register / unregister | void register(Map<String, dynamic> props) / void unregister(String key) | Super properties: what describes the whole session, such as the person's plan. Up to 20, kept on the device, sent once per session. See Events and taps. |
setAnalyticsConsent | void setAnalyticsConsent(bool given) | For an app with Wait for the user's consent on: true starts taps and screen views, false stops them. Call it on every start. See Wait for consent. |
setAnalyticsEnabled | void setAnalyticsEnabled(bool enabled) | false stops screen views, taps, events and sessions from this device, and the choice is kept. Rendel itself keeps answering. Rendel.analyticsEnabled reads it back. See Analytics consent. |
setThemeMode | void setThemeMode(RendelThemeMode mode) | Changes RendelConfig.themeMode while the app runs, for an app with an appearance switch of its own. The launcher and an open thread repaint. See Dark mode. |
refreshConfig | Future<void> refreshConfig() | Re-reads the published appearance. The SDK does not hook the app lifecycle itself; call this on foreground if you want a publish to land without a relaunch. |
events | Stream<RendelEvent> | Broadcast. |
changes | Stream<RendelChange> | What Rendel changed in your app's own data, so you can refresh what you hold of it. Broadcast. See RendelChange. |
theme / config | RendelTheme / RendelConfig | The effective values, after any published config is layered over yours. theme is the light or the dark one, whichever is drawn now; inside a widget, Rendel.themeOf(context) also rebuilds when the device switches. |
strings | RendelStrings | The words the SDK is drawing in: yours, or the shipped set for the answer language. |
configRevision | ValueNotifier<int> | Ticks when a published config lands and changes what is on screen. |
isEnabled | bool | False when you turned it off in code or the console published a kill switch. |
available | ValueListenable<bool> | Whether a new conversation can start now. False while new conversations are paused for your organization (its generated screens for the month used up, its spending cap reached, an app's questions per day used) or while Rendel's API cannot be reached. It turns true again by itself, checked every few minutes and when the app comes back to the front. RendelLauncher stays on screen either way (0.72.2): a question asked while paused is answered with a calm sentence, and one asked during an outage shows a retry. |
isInitialized | bool | — |
isOpen | bool | Whether the thread is on screen, in its sheet or shrunk to the bubble. |
deviceId | String? | The anonymous per-install id this run is sending. Null before init completes. It is what Support asks for. |
restoreWithin | Duration | One hour: how long ago the last question may have been asked for a relaunch to open on its conversation. Marked @visibleForTesting, for your own tests. |
RendelConfig
Everything that is your choice rather than the protocol's. Every field is also the floor for anything published from the console.
| Field | Default | Notes |
|---|---|---|
apiBaseUrl | https://api.rendel.ai | — |
userToken | null | Future<String?> Function(): the signed-in person's current token from your own sign-in. Asked for before every question and never stored. See Signed-in user. |
requestTimeout | 30 s | Non-streaming calls. |
streamIdleTimeout | 45 s | How long a turn may go without a single server event. Server pings every 15 s, and the SDK counts them. |
sdkVersion | flutter/<package version> (flutter/0.116.1 today) | Sent as client.sdk. |
languages | [] | The languages for a message that does not say which it is in (a "hi", a tap), in preference order — ['tr', 'en', 'ru']. A user writing in any language is answered in it. The device picks from among them; one speaking none of them gets English when the list has it, else the first, so the order is a decision. Empty hands the choice to the list published from the console, and absent that to the device's language. Different from locale, which is one device's setting. |
locale | device's own | BCP-47 (tr, pt-BR). The language Rendel answers in, and the one confirmTemplates is matched on. A message written in another language is still answered in that one. See Locales. |
assistantName | Rendel | The name at the top of Rendel's sheet. |
launcherLabel | Ask, translated | The word on the launcher. Left at Ask, it is the SDK's own word in the language Rendel answers in (RendelStrings.launcher: "Sor" in Turkish, 0.92.1). |
launcherStyle | RendelLauncherStyle.label | label draws the launcher's icon and its word; icon a round button with the icon alone, which still says the word to a screen reader. Publishable from Appearance. |
launcherIcon | sparkle | The launcher's icon, by the name Appearance lists it under (Phosphor, fill weight): sparkle, star-four, magic-wand, chat-circle, chat-dots, chat-text, chats, question, info, lightbulb, robot, headset, lifebuoy, hand-waving, smiley, heart, compass, magnifying-glass, shopping-bag or microphone. custom is your own, uploaded in Appearance; with none published it is the sparkle, as is a name this build does not carry. Publishable. |
launcherDraggable | false | People may drag the launcher. Let go, it settles on the nearer side and keeps that place on every screen and after a restart, on that device. It then draws itself once, over the app, starting where the first RendelLauncher was placed; every placement leaves an empty slot. It shows on the screens that place a RendelLauncher and on no other, as the undragged one does (0.73.1). Publishable. |
launcherFill | null | A Gradient in place of the accent under the launcher's icon and word. Drawn where its ink reads: the icon alone on the colours across the button's middle (3:1), a word on every colour (4.5:1); the accent otherwise. Publishable (0.79.0). |
launcherRing, launcherRingWidth | null, 3 | A ring round the launcher in this colour, 1–8 wide, in place of its hairline edge. Publishable (0.79.0). |
launcherGlow | null | A glow in this colour in place of the launcher's grey shadow. Publishable (0.79.0). |
launcherSize | null (46) | The round launcher's width and height, ring included, 40–72; its icon grows with it. Publishable (0.79.0). |
launcherLight | null | A light over the launcher's fill and under its icon, inside its ring: usually a RadialGradient from a colour to the same colour at alpha 0. Published as a colour strongest at a point (0–1 across and down), its strength (0.7) and its reach (0.6 of the width). Drawn as given; Appearance says when the icon is hard to read on it. Publishable (0.80.0). |
launcherIconSize | null (20) | The launcher's icon in logical pixels, 12–48; null grows it with launcherSize on the round launcher. Publishable (0.80.0). |
launcherGlowStrength | null (0.45) | How strong launcherGlow is at its brightest, 0.1–1. Publishable (0.80.0). |
suggestions | [] | Opening prompts. Name things this app can do, in the user's words. |
emptyStateTitle | null | The headline shown before the first question, in your own words. Null keeps the SDK's, translated into the language Rendel answers in. Publishable from Appearance. |
emptyStateBody | null | The line under that headline, shown before the first question. |
composerHint | null | The words in the empty message box. Null uses RendelStrings.composerHint, which is translated. Publishable. |
attachIcon / voiceIcon / sendIcon | plus / microphone / arrowUp | RendelAttachIcon (paperclip, image, plus, off), RendelVoiceIcon (microphone, waveform, off), RendelSendIcon (arrowUp, paperPlane, arrowRight). off removes that control. Publishable. |
voiceFirst | false | What the composer leads with at rest. false, the place to type, with a "+" before it and the microphone a round button after it (the default from 0.96.0). true, the microphone: a wide button in the middle, held to speak, with a "+" on one side and a keyboard on the other that opens the box to type. Publishable from Appearance › Message box › How people ask (0.95.0). |
feedback | false | "Helpful?" with a thumb up and down under each answer, counted in Analytics. Usually switched on from Appearance. |
themeMode | RendelThemeMode.system | system follows the device's dark mode as it changes; light or dark is final. Set it to what your own app does. See Dark mode. |
fontFamily / displayFontFamily | null | The family Rendel is set in, for a font your app fetches at runtime rather than bundles: RendelConfig(fontFamily: GoogleFonts.baiJamjuree().fontFamily). displayFontFamily is the one for headings, and falls back to fontFamily. A font the console publishes wins. |
enabled | true | The kill switch in code. Setting it false wins over anything published. Not a security control — the API enforces suspension server-side. |
readAloud | true | Answers read aloud in a natural voice: every answer's opening is read by itself as it arrives (the Voice replies switch in the header turns that off). False turns it off. Nothing is read until the app's console turns voice on (Assistant › Voice), and either off wins. |
remoteConfig | true | False pins Rendel to exactly what this object says. |
configStore | null | Where the last good published config is kept between launches. |
deviceIdStore | null | Where the device id is kept between launches. Use a different key from configStore — both sides read and write one string. |
onPickAttachment | built in | Returns an RendelAttachment (bytes, name, media type) from your own picker, replacing the SDK's Photos, Camera and Files; the "+" then opens yours directly. Null uses the built-in. attachIcon: RendelAttachIcon.off removes the control. |
onStopDictating | null | Ends a dictation when the user lets go of the microphone, which is held to speak (or presses the pill again, with a screen reader). Without it letting go does nothing and the recogniser ends the session itself. |
onDictate | built in | Returns recognised speech as text from your own recogniser, replacing the SDK's speech_to_text; it is handed an onPartial callback to feed the composer while somebody is still speaking. Return null when nobody spoke and throw when the recogniser failed: the SDK words the two differently and logs the error. Throw RendelDictationDenied when the person refused the microphone, and the thread says where to allow it. Null uses the built-in. voiceIcon: RendelVoiceIcon.off removes the control. |
onOpenUrl | null | Null opens a card's link in an in-app browser, so the user comes back to the conversation when they close it. Set it to route links yourself, for example to your own product screen. |
bubbleOffset | 104 | Logical pixels above the bottom edge for the bubble while a screen Rendel opened is showing, so it clears your bottom bar. Never less than the safe area. |
strings | by locale | Every word the SDK puts on screen that is not your app's or the model's. Null takes them from locale; without one, from the phone's language when your assistant answers in it (languages, else the ones picked under Persona), else English when it answers in English, else its first language — Türkçe, Deutsch, Français, Español, العربية, English elsewhere. Set it and you own every word. RendelStrings.forLocale('tr').copyWith(...) changes only the words you name and keeps the rest of that language (before 0.44.1 it returned most words in English). |
onLog | null | Point it at your crash reporter. |
httpClient | null | Test seam: pass a MockClient from package:http/testing.dart to run manifest sync, turns and action dispatch offline. Leave it null in production. |
RendelAction
What Rendel is allowed to do.
| Field | Type | Notes |
|---|---|---|
name | String | snake_case, asserted. One camelCase name used to reject the entire manifest. |
description | String | The model reads this to decide when to call it. Write it for a colleague, not for a compiler. |
params | RendelSchema | Validated server-side before an invocation exists. |
risk | RendelRisk | read runs silently; write and destructive get a server-built confirmation card, except a write that names an undo. |
handler | RendelHandler? | Future<RendelResult> Function(Map<String, dynamic> params) |
onInvoke | RendelInvocationHandler? | Future<RendelResult> Function(RendelInvocation) — the same thing plus the invocation's id and risk, for idempotency on your side. |
confirmTemplate | String? | Overrides the server's sentence on the confirm card. |
confirmTemplates | Map<String, String>? | The same sentence per language, keyed by BCP-47 tag: {'tr': '{order_id} numaralı siparişi iptal edelim mi?'}. Matched on the locale the SDK sends: the exact tag, then the language, then confirmTemplate. Sixteen at most. |
editable | List<String> | Default const []. Parameter names the user may change on the confirmation card before confirming: ['quantity']. The server checks a changed value as it checks the model's and redraws the card. A quantity, a note, one of a few choices; never an id or an amount the app computes. See Values the user can change on the card. At most twelve. |
undoable | bool | Default false. For a destructive action the user can still take back afterwards, such as an order that can be cancelled while it is packed: its card does not say "This cannot be undone". |
typeToConfirm | String? | A parameter the user types back before the confirm button works ("type the app's name to delete it"). Only on an action that changes something, never one in editable; the server checks it again. |
fullText | RendelFullText? | RendelFullText('body'): a string parameter the card shows whole, as a preview and then Read all, and the confirm button works once all of it has been opened. With current: true the card also shows the lines that change, from the text Rendel.setCardSource hands it. |
confirmLabel / confirmLabels | String? / Map<String, String>? | The confirm button's words ("Delete app"), up to 32 characters, and the same per language, matched like confirmTemplates. |
undo | RendelUndo? | The action that takes this one back: RendelUndo('remove_from_cart') on add_to_cart. A write that names one runs with no confirmation card, and the answer opens with a line saying what it did and an Undo that works for ten minutes. Parameters the two share by name pass through; params fills the others from the call ('{params.product_id}') or from what it returned ('{result.line.id}'). Never on a payment, an order, a cancellation or a delete. |
confirm | RendelConfirm? | RendelConfirm.always keeps the card for a write that has an undo. A destructive action always asks, whatever this says. |
timeout | Duration | Default 15 s, capped at 120 s. |
sandboxResult | Map<String, dynamic>? | Returned instead of running the handler on a test key. |
Rendel.registerAction(RendelAction(
name: 'add_to_cart',
description: 'Add a product to the cart',
params: RendelSchema.object({
'product_id': RendelSchema.string(),
'quantity': RendelSchema.integer(),
}),
risk: RendelRisk.write,
confirmTemplate: 'Add {quantity} to your cart?',
editable: ['quantity'],
handler: (params) async => RendelResult.ok(await cart.add(params)),
));RendelSchema
Parameter shapes, without hand-writing JSON Schema.
RendelSchema.object({
'order_id': RendelSchema.string(description: 'The order number'),
'reason': RendelSchema.enumOf(['damaged', 'wrong_item', 'other']).optional,
'quantity': RendelSchema.integer().optional,
'tags': RendelSchema.list(RendelSchema.string()),
})string, number, integer, boolean, enumOf, file, list, object, and raw for anything the helpers do not cover. .optional (or .orAbsent) on any of them.
RendelSchema.file() (from 0.116.0) takes a file the person attached in the conversation. The handler is given its id, and Rendel.attachment(id) returns the file (RendelAttachment: bytes, name, mediaType), or null when nobody attached one:
params: {'photo': RendelSchema.file(description: 'The outfit photo.').optional},
handler: (p) async {
final photo = await Rendel.attachment(p['photo'] as String?);
if (photo == null) return RendelResult.fail('No photo attached.');
return RendelResult.ok(await api.score(photo.bytes));
},RendelResult
RendelResult.ok(Map<String, dynamic> data) or RendelResult.fail(String error). The failure string reaches the model, so write it as something the model can act on: "no order with that number" beats "404".
RendelRisk
read, write, destructive. See Actions and risk levels.
RendelInvocation
id, name, params, risk. The id is stable across a retry of the same turn, so it is the natural idempotency key for whatever your handler does.
Take it with onInvoke when running an action twice would be worse than not running it: an app killed between running the handler and reporting the outcome leaves the server without a result, and the model may propose the same thing again.
Rendel.registerAction(RendelAction(
name: 'refund_order',
description: 'Refund an order to the original payment method',
params: RendelSchema.object({'order_id': RendelSchema.string()}),
risk: RendelRisk.destructive,
confirmTemplate: 'Refund order {order_id}? This cannot be undone.',
onInvoke: (invocation) async {
// The same id comes back if the turn is resumed after a dropped stream.
if (await refunds.alreadyProcessed(invocation.id)) {
return RendelResult.ok({'status': 'already_refunded'});
}
return RendelResult.ok(await refunds.create(
orderId: invocation.params['order_id'] as String,
idempotencyKey: invocation.id,
));
},
));RendelRouteParam
RendelRouteParam.string(), .number(), .boolean(), each taking description, required and fromActions. With fromActions: true the value must be one an action returned in this conversation, so a guessed order id never opens the screen.
Rendel.registerRoute(
'order_detail',
title: 'My orders › Order',
description: 'One order: its items, delivery and payment.',
params: {'order_id': RendelRouteParam.string(required: true, fromActions: true)},
open: (p) => navigatorKey.currentState!.pushNamed('/orders/${p['order_id']}'),
);open is a RendelRouteOpener, FutureOr<void> Function(Map<String, Object?> params), and gets the params the server checked.
RendelLauncher
RendelLauncher({String? label, RendelLauncherBuilder? builder}). Draws nothing when Rendel is uninitialised or disabled, so you can leave it in the tree unconditionally. It also steps aside while the thread is shrunk into its bubble for a screen it opened, since the bubble is the way back then: one way in on screen at a time. A button of your own does the same by listening to Rendel.minimised (a ValueListenable<bool>).
Place it where a floating button goes, usually Scaffold(floatingActionButton: const RendelLauncher()). The Scaffold keeps a floating button above its bottom bar, the keyboard and the safe area, but not above your own content, so on a screen whose main button sits at the foot of the page (a cart's checkout), leave the launcher off that screen (floatingActionButton: onCart ? null : const RendelLauncher()), or put that button in the Scaffold's bottomNavigationBar or persistentFooterButtons, which the floating button sits above. With launcherDraggable on, people can also move it out of the way, and it stays inside the safe area.
It also shows a waiting follow-up over itself, anchored to it in the app's overlay, so your layout does not move (0.59.0), or across the top of the screen when the send chose a banner (0.59.7).
builder draws the button as your own widget (0.81.1). Return the visual only: Rendel makes it pressable, says the label to a screen reader, puts its own count or dot on the corner, steps it aside for the bubble, shows a waiting message over it and drags it when launcherDraggable is on. Appearance's launcher look (gradient, light, ring, glow, size, icon) does not apply to it, and Appearance says so once the app has run with it. From 0.99.0 the SDK also sends a picture of that button, 1.5 s after it is first drawn and only when it changed, so Appearance shows your button where your app draws it instead of Rendel's.
RendelLauncher(
builder: (context, status) => MyGradientButton(
// status.label, status.unread (the team's unread lines), status.waiting
semanticsLabel: status.label,
),
)RendelTheme
See Theming. Built with RendelTheme.fromTokens(...), which derives readable text and border roles from your four colours rather than trusting them — a themeable SDK that does not do this ships unreadable badges.
RendelTheme.paper() and RendelTheme.deep() are the two built-in themes; fromTokens(...) builds yours. RendelThemeScope.of(context) reads the theme inside a custom component. contrastRatio and auditContrast check your colours.
RendelLook
Two optional touches that make the panel feel like your app. Set them once, before the panel first opens.
// The soft light behind the panel, in your own colours: left, then right.
// Drawn as pale pastels; unset, both sides are your theme's accent.
RendelLook.groundLight = (const Color(0xFFD9A43A), const Color(0xFF1E3B2F));
// A suggestion's own row: a short title and the line under it, keyed by
// the suggestion's text.
RendelLook.suggestionCards = const {
"Where's my order?": RendelSuggestionCard(
title: 'Track my order',
line: 'Where it is right now',
),
};A suggestion without a card is drawn with its own words, up to two lines. Since 0.93.0. The suggestions are a list under the greeting, one card with a row for each and an arrow at the end. Since 0.114.0 a card's image is accepted and no longer drawn: the row of picture cards over the message box is gone.
Appearance › Assistant screen › Behind the assistant sets the light's two colours and its strength from the console, and wins over RendelLook.groundLight (0.106.0); see the light behind the panel.
RendelConfigStore
abstract class RendelConfigStore {
Future<String?> read();
Future<void> write(String value);
}One interface, two uses: RendelConfig.configStore and RendelConfig.deviceIdStore. By default both are kept in the app's preferences (shared_preferences). RendelMemoryConfigStore is the in-memory option, and the default under flutter test.
RendelLogRecord, RendelLogLevel, RendelLog
Where the SDK reports what it could not tell you any other way.
code | When |
|---|---|
invalid_key | appKey does not start with rd_pk_ (or nc_pk_, a key made before the rename), is still an example's placeholder, or the server does not know it. |
app_suspended | Debug: the app is suspended in the console, so the launcher is hidden. |
unavailable | New conversations are paused, or the API cannot be reached, for the reason in the message. The launcher stays; see available. |
handler_failed | An action handler threw. |
handler_timeout | A handler passed its timeout. |
result_too_large | A handler returned more than 32,768 characters of JSON; Rendel passed on its start and told the assistant there is more (before 0.107.0, more than 16,384 failed). |
context_provider_timeout | A context provider missed its 300 ms budget. |
context_provider_failed | A context provider threw. |
manifest_sync_failed | The server rejected the manifest. The message carries the field and the reason. |
transport_failed | A network call failed. |
identify_refused | The server refused identify: a userHmac that does not match, an id that is no id, or a key it does not know. Or it bound nobody (identify_unsigned): an id without userHmac on a install that has not been that person, whose questions then count as an anonymous visitor's. Logged once with the server's code and reason, and not tried again. |
config_unreadable | A published config could not be parsed, or was not legible on this device. |
config_cache_write_failed | The config store threw on write. |
device_id_ephemeral | No deviceIdStore is set, so the device id is new each launch. Debug level, once. |
device_id_store_failed | The store threw or hung. |
usage_description_missing | Info.plist lacks NSMicrophoneUsageDescription or NSSpeechRecognitionUsageDescription, so the built-in microphone is not drawn, or NSCameraUsageDescription, so the "+" offers no Camera. iOS would close the app the first time either was used. |
user_store_failed | The signed-in user could not be stored or read back, so a relaunch starts signed out until the next identify. |
conversation_store_failed | The last conversation could not be stored or read back, so a relaunch opens a fresh thread. |
analytics_store_failed | The analytics switch or the super properties could not be stored or read back. |
call_failed / mail_failed / copy_failed / calendar_failed | The dialler, mail app, clipboard or calendar editor could not be opened for a call, email, copy or add_to_calendar tap. |
open_url_failed / open_external_failed | A link could not be opened in the in-app browser, or could not be handed to the system. |
route_open_failed | A registered route's open threw. |
dictation_failed | The recogniser failed: your onDictate threw, or the built-in one could not start. |
settings_failed | The app's page in iOS Settings, offered after the microphone was refused, could not be opened. |
read_aloud_failed / read_aloud_stream_failed | An answer could not be read aloud in the natural voice. |
voice_session_failed | The phone would not start or stop the audio session the voice plays in. |
user_token_failed | userToken threw; the turn went without a token. |
followup_open_failed | A follow-up's conversation could not be loaded; the thread opened as it was. |
invalid_goal / invalid_purchase | track was given a goal name that is not lowercase letters, digits and _ (a letter first, at most 40), a goal value without a three-letter currency, or a purchase without a value of 0 or more and a currency. Nothing was sent. |
invalid_prop | A property given to track or register was left out: a name that is not lowercase letters, digits and _, a value that is not a string, a number, a bool or null, or one past 20. The rest was sent. |
invalid_screen | setScreen was given an empty name. Use null to go back to the route. |
taps_no_screen | Debug: a tap came before any screen was named, so it was not counted. Add Rendel.navigatorObserver, or call Rendel.setScreen. |
tap_unreadable | A tap could not be read, and was not counted. |
push_platform | setPushToken was called somewhere other than iOS or Android. Nothing was sent. |
push_not_set_up | rendel_push on Android found no Firebase in the app and none in Settings › Push & email yet. No token was sent; it is sent at the next launch after the key is added. |
push_token | The platform gave no push token. On iOS this is most often a build without the Push Notifications capability (no aps-environment). |
surface_stale | Debug: a block arrived for a surface_id with a revision no newer than the one on screen, and was dropped. |
paired | Debug: pair was accepted; the console watches until the time in the message. |
pair_test_only / pair_not_found / pair_rate_limited / pair_failed | Why pair did not pair: a live key; a wrong, used or expired code; too many tries in a minute; anything else. The web SDK uses the same codes. |
code is stable and safe to switch on; message is for humans and may be reworded. A turn the server ends with an error is logged under that error's own code (see Errors).
RendelEvent
opened, closed, messageSent, actionExecuted. For your own analytics.
RendelChange
Rendel changes your data on your own API, as the signed-in person, and your
app's screens may still hold what they read before: a favourites list read at
launch, a cart kept in memory. Rendel.changes says when that happened, so
you can reload it.
Rendel.changes.listen((change) {
// change.action: the action's name as the console lists it, e.g. add_to_list
// change.params: the values the call was made with, as the card showed them
if (change.action.contains('list')) savedListsCubit.reload();
if (change.action.contains('cart')) cartStore.refresh();
});Fires once for every write the server carried out for the person (a confirmed
card, or a card-less write with an Undo), and once more with undone true when
they take one back. An action your app runs itself (registerAction) is your
own code and fires actionExecuted instead; a read fires nothing.
Preference memory
Rendel keeps a preference a person states once, such as "always lactose-free", or one it notices more than once, and uses it in later answers.
See what it looks like to your customers and your team: Memory.
- Every save is shown under the answer as a chip, with Undo. Updated and forgotten preferences, and an answer based on one, are shown there too.
- A card value or form field filled in from a preference says "From your preferences".
- "What I remember for you" lists each preference with Forget, and Forget all. It opens from those chips, or from your own settings or privacy screen with
Rendel.openMemory(context). - The same list shows what answers read about the person beyond those preferences: the
traitsyou pass toidentifyand the facts your backend keeps withPOST /v1/people/:id/notes, marked "From the app" and without Forget, and what Rendel noticed without naming it, under "Other", with Forget. Pass only traits you would show the person. - For someone who is not signed in, preferences are kept for that device; they move to the account when
identifyis called. - Turn it off in the console under Settings › Data & privacy › Preference memory. Off, nothing new is kept, and the list says the app keeps no preferences.
Turn on identity verification and pass userHmac to identify. Until then, a user's preferences are read only on a device that has been that user before, so someone who knows their id cannot open them elsewhere, and a signed-in person's list shows only what that device kept while they were signed out. The Undo under a save works either way, on the device that saved it.
Screen views and goals
Rendel answers about the screen in front of the person: "what does this mean?" on the payment screen is a question about that payment. Analytics › Explore › Events shows which screens are seen most and what people asked on each, and Value how often people reach your goals after a conversation with Rendel. One line gives it the screens:
MaterialApp(
navigatorObservers: [Rendel.navigatorObserver],
// …the rest of your app, unchanged
);
// With go_router:
final router = GoRouter(
observers: [Rendel.navigatorObserver],
routes: [/* … */],
);CupertinoApp takes the same navigatorObservers. Keep any observers you already have in the list.
- From then on every screen the app shows is sent as a screen view, from every device, whether or not the person opens Rendel. The name is the route's name with its ids replaced:
/orders/8812becomes/orders/:id. Digits, UUIDs, long hex strings, long tokens and email addresses become:id; a query is dropped. A screen Rendel opened from one you registered withregisterRouteis called by that screen'stitle. - The same screen twice in a row is sent once. Views go in batches: every 15 seconds, when the app goes to the background, or sooner when many add up.
- Each question carries the screen it was asked on, and Rendel also reads the few screens before it.
- A screen view is the screen's name only: never a field or what the screen shows. Taps are counted on their own, without what was typed; see Events and taps. How long it is kept is under Storage and retention.
Where the route's name says too little (a route pushed without one, or tabs inside one route), name the screen yourself with Rendel.setScreen('Checkout › Payment'). It names the current page, and the name stays with that page: going back to it brings the name back. Rendel.setScreen(null) hands it back to the route's name.
A goal is what your app counts as a success:
// Where sign-up succeeds:
Rendel.track('signup');
// A success with a value:
Rendel.track('booking', {'value': 120, 'currency': 'TRY'});Every track call is an event. A name counts as a goal once it is marked as one in the console; every name your app already sent as a goal is marked for you. Names are lowercase, a letter first, then letters, digits or _, up to 40 characters. value is optional, 0 or more, and needs a three-letter currency. A goal sent from the app is shown as reported by the app; for a count nobody can forge, send it from your server, signed with your identity secret: POST /v1/goals.
On iOS, the package's privacy manifest declares what this sends; see App Store privacy.
Events and taps
Count the steps that matter in your app, and Analytics builds funnels from them: where people drop before buying, and whether those who asked Rendel went further.
Rendel.track('add_to_cart', {'product_id': 'sku_812', 'price': 549.9, 'in_stock': true});
Rendel.track('checkout_started', {'items': 3});
// What describes the whole session:
Rendel.register({'plan': 'pro'});
Rendel.unregister('plan');- Properties are one flat map: up to 20 keys, named like event names, each value a string of up to 255 characters, a finite number, a bool or
null. Nothing nested. A longer string is cut; a key or value that does not fit is dropped and the event is kept. - A string that looks personal (an email address, a phone number, a card number, an IBAN, an 11-digit national id or any run of four or more digits) is replaced with
[masked]on the device, and again on the server. - Super properties follow the same rules, up to 20. They are sent once per session, so a change in the middle of a session applies to that whole session.
Taps. See which buttons people press on the way to buying or leaving, with no code to add. From init, the SDK counts taps on buttons, links, tabs, list tiles and anything else that declares itself tappable to accessibility, or is built with a GestureDetector. A tap records the screen, the kind of control, its caption (the semantics label or tooltip, else its text) cut to 50 characters and masked as above, and a locator made of the widget types from the route down, or the widget's Key when it has one. The work runs after the frame, so a tap is never slowed.
Never recorded: what is typed into a TextField (a tap on a field records its label or hint only), the text of list rows (a row is recorded by its position), where on the screen the tap was, scrolling, drags or a picture of the screen. Taps on Rendel's own sheet are not counted.
Three widgets tune it:
// A stable name, the same in every language:
RendelName('add_to_cart', child: FilledButton(onPressed: add, child: Text('Sepete ekle')));
// Counted, with no caption: for balances, messages, names
RendelMask(child: BalanceCard(account: account));
// Not counted at all
RendelIgnore(child: PinPad(onDigit: enter));In the console, Settings › Data & privacy › What Rendel records turns taps on, keeps them without captions, or turns them off; keeps the taps of all devices, half or a tenth (chosen by device, so a person's path stays whole); and lists screens where taps keep no caption. A change reaches each device the next time the app starts. An app with strict masking on records taps without captions.
What the SDK cannot see, said plainly:
- With
--obfuscate, and in Flutter web release builds, widget type names change between releases, so a locator can too. Captions andKeys still hold;RendelNameholds always. - A control drawn with
CustomPaint, a game or a canvas, with no semantics and no text, is recorded as a tap on its screen with no control. - WebViews, maps and native ads are not seen.
- An icon-only button with no tooltip or
semanticLabelhas no caption. Give it a tooltip, which also helps screen readers, or aRendelName.
Analytics consent
When your app asks people whether they accept analytics, pass their answer to Rendel:
// Declined:
Rendel.setAnalyticsEnabled(false);
// Accepted later:
Rendel.setAnalyticsEnabled(true);Off stops screen views, taps, events and sessions from that device, and the choice is kept there. Rendel itself keeps answering. Your app owns the consent screen; Rendel does not show one. For Google Play's form, see Google Play data safety.
Follow-ups
When something a person asked for has news (a price that dropped, an answer that arrived, a date coming up), Rendel tells them. Whichever way a message went, by push, by email or in the app, it waits as a card at the top of the thread when the person opens Rendel: up to three from the last seven days that they have not opened or put away (0.59.7). A message sent "In the app" also shows on the app's screens while the thread is closed: over RendelLauncher as a popup, or across the top as a banner, as the send chose. The SDK asks for it after init and whenever the app comes back to the front, at most every ten minutes. A tap opens the conversation about it. The words are the server's, already in the person's language.
An app with its own launcher draws its own:
ValueListenableBuilder<RendelFollowup?>(
valueListenable: Rendel.followup,
builder: (context, followup, _) => followup == null
? const SizedBox.shrink()
: MyBanner(
title: followup.title,
body: followup.body,
button: followup.button,
onOpen: () => Rendel.openFollowup(context),
onClose: Rendel.dismissFollowup,
),
);Call Rendel.track('purchase', {'value': 549.9, 'currency': 'TRY'}) when the person buys, and Follow-ups credits the purchase to the follow-up they last opened. Rendel.reset() drops a follow-up meant for whoever was signed in, here and on the server.
An answer that finished after the person had left the app, and a confirmation card they left unanswered, come the same way, by push or as a card in the app, and a tap opens the very conversation. Nothing to add: see Notify when done.
RendelFollowup
id, type (watch, date, answer_arrived, task_done, confirm_waiting, …), title, body, button, channel (in_app, push or email) and style (popup or banner, for an "In the app" message), all strings.
Push notifications
The rendel_push package brings follow-ups to the lock screen, so a price that dropped or an answer that arrived reaches people while your app is closed. It asks for notification permission, hands the token and every refresh to Rendel.setPushToken (null when notifications are off), and opens Rendel's pushes with Rendel.handlePush, including the one that launched the app. A push that is not Rendel's is left to your app.
- iOS: straight to Apple. No Firebase in your iOS app: the package reads the device token itself, and Rendel sends with your app's Apple push key.
- Android: Firebase Cloud Messaging, from Gradle. No Dart-side Firebase package, so no version pin against your own. An app without Firebase needs no
google-services.json: Rendel reads the project's options from your service account and the package starts Firebase with them. An app that has Firebase keeps it, and Rendel sends through that project.
A message about a product or an offer carries its picture. On Android it shows by itself. On iOS, add a Notification Service Extension that downloads image_url from the payload; without one the notification arrives with its words and no picture.
Your part is one file per platform, in the console under Settings › Push & email:
| Platform | File | Where you get it |
|---|---|---|
| iOS | Apple push key, AuthKey_<Key ID>.p8 | developer.apple.com › Certificates, IDs & Profiles › Keys › + › Apple Push Notifications service (APNs) › Continue › Register › Download. One key serves every app of your team. |
| Android | Firebase service account key (JSON) | console.firebase.google.com › your project › Project settings › Service accounts › Generate new private key. With no Firebase project yet, add one first (free). |
The console reads the Key ID from the file's name and the Team ID and Bundle ID from your app's latest build, checks the key with Apple (or Google) at once, and then Send me a test push sends one to the phone you paired on the Test page. If the service account may send but not read the project's apps, the console asks for that app's google-services.json instead and says why.
The AI setup writes the code side for you. By hand:
- Add the package at the same tag as
rendel:
dependencies:
rendel:
git:
url: https://github.com/neon-apps/rendel-flutter.git
ref: v0.116.1
rendel_push:
git:
url: https://github.com/neon-apps/rendel-flutter.git
path: rendel_push
ref: v0.116.1- After
Rendel.init(...), and ask for permission at a moment the person sees why (after sign-in, or a first order), not at launch:
final navigatorKey = GlobalKey<NavigatorState>();
await RendelPush.init(navigatorKey: navigatorKey, askPermission: false);
runApp(MaterialApp(navigatorKey: navigatorKey, home: const Home()));
// Later, when it makes sense to the person:
await RendelPush.requestPermission();- On iOS, the Push Notifications capability:
ios/Runner/Runner.entitlementswithaps-environmentset todevelopment(an App Store archive makes it production), set as the Runner target'sCODE_SIGN_ENTITLEMENTS, andremote-notificationunderUIBackgroundModesinInfo.plist. Android needs nothing: the package declares the notification permission and its messaging service.
askPermission: true (the default) asks at init. If your app or a push provider's SDK (OneSignal, Insider, Netmera, Braze) handles notification taps itself, pass the data of a tapped notification on with RendelPush.handleTap(context, data); it returns false for anything that is not Rendel's. RendelPush.stop() stops listening.
Rendering your own component
ComponentRegistry.register(String type, ComponentBuilder builder) puts a widget of yours in the catalog's place. ComponentBuilder is Widget Function(BuildContext context, WireBlock block, RendelDispatcher dispatch). RendelActionButton, RendelChip, RendelControlShell, RendelOverline, RendelPressable, RendelPulse and RendelSwap are exported so your component presses, encloses and breathes like a built-in rather than like Material.
RendelDispatcher
How your component talks back. The SDK hands one to your builder; you never construct it. A member that is null means this build cannot do that, so draw that part as content.
| Member | Signature | Notes |
|---|---|---|
onAction | Future<bool> Function(UIAction) | Fires a tap; resolves false when the tap was dropped. |
canHandle | bool Function(UIAction) | Ask before drawing a tap surface; false means draw it as content. |
onSubmitForm | Future<RendelSubmitOutcome> Function(String formId, Map<String, Object> values) | Values are String, num, bool or List<String>. |
onSelect | Future<bool> Function(WireBlock, String id, String shown)? | A variant_picker or datetime_slots pick, sent as a selection. Null where nothing can be picked. |
onChoose | Future<bool> Function(WireBlock, List<String> ids, String shown, {String? otherText, Duration lit})? | A choice answer: ids, or otherText, or nothing for skip. |
onRate | Future<bool> Function(WireBlock, int score, {String? comment})? | A rating score and optional comment, posted to /v1/ratings with no turn. |
onPickFile | Future<RendelAttachment?> Function(RendelAttachSource)? | A form upload field's picker. Resolves null when the user backs out. |
fileSources | List<RendelAttachSource> | Where onPickFile can pick from. |
onUpload | Future<String> Function(RendelAttachment)? | The upload that resolves an upload id. Throws RendelUploadFailure, whose message is the server's sentence. |
routeTitle | String? Function(String route)? | The app's title for a registered route, for screens. |
onEditCard | Future<Map<String, String>?> Function(WireBlock card, Map<String, dynamic> edits)? | Sends the values the user changed on a confirm_card, to be checked and the card redrawn. Resolves null when they were accepted, otherwise what was wrong by parameter. Null where nothing can be changed: draw the values as text. |
cardSource | Future<String?>? Function(String action, Map<String, dynamic> params)? | The current text a full-text card's action replaces, from setCardSource; null when the app gave none. |
onUndo / undoPhase | Future<String> Function(WireBlock)? / String? Function(WireBlock)? | The Undo on the line an action leaves in the answer: runs the inverse once and resolves where it stands (undone, failed); undoPhase says it meanwhile (undoing, undone, failed), null while it can be tapped. Null draws the line without its Undo. |
onOpenMemory | VoidCallback? | Opens "What I remember for you", from a value marked "From your preferences". Null draws the mark as text. |
onContactOpen | void Function(WireBlock, String channel)? | A contact block's channel was tapped (call, email, url), counted on the side. The channel opens either way. |
UIAction
A sealed union: ReplyAction, OpenUrlAction, NavigateAction, CallAction, EmailAction, CopyAction, AddToCalendarAction, ConfirmAction, CancelAction, AppActionRef. New kinds arrive in minor releases, so give any switch over it a wildcard (_ =>) case.
Names from before 0.33.0
Every NC*, NeonCopilot and Copilot* name is a deprecated typedef of its Rendel* replacement, and each goes at 1.0.