Agent settings

Everything the dashboard decided, so your app does not hard-code any of it.

config()

Minimal

dart
final agent = await tigerbase.config();
print(agent.botName);   // Pine

Realistic

Harbor & Pine’s help tab paints its title, its opening line and its suggestion chips from the dashboard — so when the shop changes a starter question, the app changes with it, with no release.

lib/help_intro.dart
class HelpIntro extends StatelessWidget {
  const HelpIntro({super.key, required this.agent, required this.onAsk});

  final AgentConfig agent;
  final void Function(String question) onAsk;

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Text(agent.botName ?? 'Harbor & Pine',
            style: Theme.of(context).textTheme.titleLarge),
        if (agent.tagline != null) Text(agent.tagline!),
        const SizedBox(height: 12),
        Text(agent.initialMessage ?? agent.welcomeMessage ?? 'How can we help?'),
        Wrap(
          spacing: 8,
          children: [
            for (final question in agent.starterQuestions)
              ActionChip(label: Text(question), onPressed: () => onAsk(question)),
          ],
        ),
      ],
    );
  }
}

Warningask() does nothing until something listens

chat.ask(question) returns a Dart Stream, and streams are lazy: calling it and dropping the result sends nothing at all. That is why the chip above calls your own onAsk, which listens — see Sending & receiving.

What comes back

botName, taglineWhat the agent calls itself, and one line about what it is for. Both nullable — an agent that has configured neither still has to render.
initialMessageThe opening line. Show it as the first message rather than leaving the thread empty. welcomeMessage is the older name on older agents.
starterQuestionsNever null. An empty list when none are set, so you can map over it without asking.
languagear or en. Drive your Directionality from this and the layout mirrors for free.
primaryColor, backgroundColor, textColor, userMessageBg, botMessageBg, headerBgCSS colour strings, because the same settings serve the web widget. Parse them once — see below.
borderRadiusnone, sm, md, lg, xl or full — a name, not a number.
fontFamilyWritten as it would be in CSS. Map it to a font your app bundles, or ignore it.
handoffEnabled, greetingEnabled, showBrandingFlags. Nullable, so absent and false stay distinguishable.
greetingMessages, greetingDelaySecondsThe proactive opener: lines to pick from, and how long to wait.
widgetTemplateThe web widget's layout. Not meaningful in an app.
extraEverything the server sent, flat. The escape hatch for a field the dashboard gained after this version shipped.

NoteWhy `extra` is a map and not dynamic fields

An agent that answers every property name makes agent.botNme compile and return null — which is most of the type safety you install a typed client for, traded away for forward compatibility nobody asked for. A typo in a named field is a compile error; a genuinely new field is one line away in extra.

Colours arrive as strings

primaryColor is "#1f4d3a", because the same dashboard settings also drive a web page. Convert once.

Parsing

lib/colours.dart
Color? parseHex(String? value) {
  if (value == null) return null;
  final hex = value.trim().replaceFirst('#', '');
  if (hex.length != 6) return null;
  final rgb = int.tryParse(hex, radix: 16);
  return rgb == null ? null : Color(0xFF000000 | rgb);
}

final brand = parseHex(agent.primaryColor) ?? Theme.of(context).colorScheme.primary;

Text on it

Picking a readable foreground
final onBrand =
    ThemeData.estimateBrightnessForColor(brand) == Brightness.dark
        ? Colors.white
        : Colors.black;

FilledButton(
  style: FilledButton.styleFrom(backgroundColor: brand, foregroundColor: onBrand),
  onPressed: () => onAsk(question),
  child: Text(question),
);

TipCheck the contrast before painting text on it

A pale brand colour with white text is not hard to read, it is absent — and whoever chose the colour never notices, because they already know what the button says. Flutter’s ThemeData.estimateBrightnessForColor picks black or white for you; use it rather than assuming white.

It is fetched once

The result is cached, as a future rather than a value — two widgets building at the same time would otherwise each fire the request before either resolved. A failure is not cached, so one bad minute on a train does not mean the agent never loads for the rest of the session.

WarningWhen it fails

config() is usually the first request an app makes, so a wrong key or a refused origin shows up here first, as a TigerbaseError. Both fail the same way every time until a setting changes, so do not retry them — see Errors.