Skip to the guide

Need help? Your SensibleStats contact can answer questions about any guide and send the three values. Write to solutions@sensiblestats.com.

Highlighted values such as YOUR_PUBLIC_KEY are placeholders. Replace them with the values we send you.

Widget guides / Flutter

Chat widget in your Flutter app

Add two Dart files to your app and visitors get a chat that answers questions about matches, teams and players, with stats and your prices. This guide covers every setting, callback and object those files give you.

Checklist:

  1. Get your operator id, public key, widget origin and the wrapper files from your SensibleStats contact.
  2. Ask your contact to switch mobile on for your account.
  3. Add the files and dependencies, create one controller with the signed-in visitor's id, and place the launcher.
  4. Set onAddToSlip, then test an add, a duplicate and a reject.
  5. Set onUnavailable, reload the chat when the visitor signs in or out, and register the Android renderer guard.

1. What your visitors get#

  • A chat icon in a bottom corner, with a teaser beside it: a short greeting about a game, often with one of your prices and a few suggested questions.
  • A chat sheet where visitors ask in their own words and get answers as text and cards: stats, form, line-ups, standings and your prices.
  • Add to slip. A price in the chat carries a button that hands the selection to your code (section 7).

Terms used in this guide:

  • Wrapper is the set of Dart files your SensibleStats contact sends you. It shows our chat page https://your-widget-host/m in a WebView, draws the icon and teaser, opens the chat in a bottom sheet and passes messages between the page and your code. You never build the page URL yourself.
  • Operator id and public key identify your account to our server.
  • Widget origin is the address of our server for your account, shown here as https://your-widget-host.
  • Teaser is the short greeting bubble above the chat icon.
  • Bet slip (or slip) is the list of selections a visitor collects in your app before placing a bet.
  • Price is your odds for one selection.
  • matchOddsId is your sportsbook's own id for one selection: one outcome of one market.
  • operatorUserId is your id for the signed-in visitor (section 5).

2. Before you start#

You need three values and the wrapper files from your SensibleStats contact.

From usExampleWhat it is
Operator idYOUR_OPERATOR_IDYour account in our system. Part of every request.
Public keyYOUR_PUBLIC_KEYIdentifies your widget.
Widget originhttps://your-widget-hostThe address the chat page loads from. Must be https.
To usWhat it is
Switch on mobileAsk your contact to switch mobile on for your account. Until then the chat does not start and reports mobileDisabled (section 11). There is no list of allowed domains for mobile.

Your app also needs:

RequirementValue
Flutter3.44 or later (Dart ^3.12.1)
iOS15.0 or later
AndroidminSdk 24 or later. Renderer-crash recovery needs API 26 or later (section 12).
Android permissionandroid.permission.INTERNET in AndroidManifest.xml
A signed-in visitorRequired. With no visitor id the chat does not start (section 5).

3. Add the widget#

Add the files. Put the two Dart files in your app's lib folder, keeping the src folder:

FileWhat it is
lib/sensible_stats_chat.dartThe file you import. It exports everything in this guide.
lib/src/chat.dartThe code behind it. Import sensible_stats_chat.dart, not this file.

The top-level constant wrapperVersion holds the wrapper's version, '1.0.0' today. Quote this value when you contact us; your contact tells you when to update.

The file exports short names such as UserContext, Position and Sport. If one clashes with a name in your app, import it with a prefix (import 'package:your_app/sensible_stats_chat.dart' as ss;) and write ss. before every name from it. The samples below use no prefix.

Add the dependencies to pubspec.yaml:

YAML
dependencies:
  webview_flutter: ^4.14.1
  webview_flutter_android: 4.14.1
  webview_flutter_wkwebview: ^3.26.2
  url_launcher: ^6.3.3

webview_flutter_android is pinned to exactly 4.14.1: the Android crash guard in section 12 is built against that version.

Create the controller once and keep it for the life of the app, in a State.initState or a singleton. It loads the chat page straight away, before any widget is on screen, so the icon and teaser are ready when the visitor gets there.

Dart
import 'package:flutter/material.dart';
import 'package:your_app/sensible_stats_chat.dart';

SensibleStatsConfig chatConfig(String userId) => SensibleStatsConfig(
  baseUrl: 'https://your-widget-host',
  operatorId: 'YOUR_OPERATOR_ID',
  publicKey: 'YOUR_PUBLIC_KEY',
  userContext: UserContext(operatorUserId: userId),
  locale: 'en-GB',
  greetingMessage: 'hello',
);

class _HomePageState extends State<HomePage> {
  late final SensibleStatsChatController _chat;

  @override
  void initState() {
    super.initState();
    _chat = SensibleStatsChatController(
      config: chatConfig(currentUser.id),
      onAddToSlip: _addToSlip,
    );
  }

  @override
  void dispose() {
    _chat.dispose();
    super.dispose();
  }
}

Names that start with my, My or your, and currentUser and HomePage, stand for your own code. _addToSlip is in section 7.

Place the icon. SensibleStatsLauncher draws the icon and teaser. Put it last in a Stack that covers the screen; it aligns itself to a bottom corner inside the safe area.

Dart
@override
Widget build(BuildContext context) {
  return Scaffold(
    body: Stack(
      children: [
        myScreenContent,
        SensibleStatsLauncher(controller: _chat),
      ],
    ),
  );
}

There is no sheet widget to place. Tapping the icon calls _chat.open(context), which shows the chat as a modal bottom sheet over the current route.

Call dispose() when you are done with the controller, as above. It stops its timers and answers a waiting tapPrice() with null. Every call after it does nothing.

4. Settings#

SensibleStatsConfig holds every setting. Its field names match the web widget's init() keys. The callbacks are not in the config; they are properties of the controller (end of this section).

Required#

FieldTypeWhat it does
baseUrlStringThe widget origin. Must be an https URL with a host, or the controller's constructor throws an ArgumentError. Any path is replaced with /m.
operatorIdStringYour operator id.
publicKeyStringYour public key.
userContextUserContextThe signed-in visitor: UserContext(operatorUserId: id). See section 5.

With operatorId or publicKey empty, the chat does not start and reports authFailed.

Visitor, language and time#

FieldTypeDefaultWhat it does
localeString?your account's default language (English unless you asked for another)The language of the chat and its answers, as a language tag, e.g. en-GB, tr.
timeZoneString?the device's zoneIANA zone, e.g. Europe/Istanbul. Kick-off times and day names follow this zone. An unknown zone falls back to the device's.
oddsFormatOddsFormat?: decimal, american, fractionaldecimalHow prices are written. A visitor who picks a format in the chat's settings keeps their choice.

Greeting and page#

FieldTypeDefaultWhat it does
greetingMessageString?noneSent once when the page loads; the answer becomes the teaser. Use hello. Without it there is no greeting and no teaser.
pagePageContext?noneThe screen the visitor is on, so the greeting can lead with it. Section 6.
placeholderString?localizedText in the empty question box.
startersList<String>?noneSuggested questions shown in an empty chat. A question must not contain |, which separates them.

Look#

FieldTypeDefaultWhat it does
themeChatTheme: auto, light, darkautoauto follows the device setting. A visitor who picks a theme in the chat keeps their choice, and the icon follows it.
colorsChatColors?oursChatColors(light: ThemeColors(...), dark: ThemeColors(...)). Section 10.
logoUrlString?our markYour logo, shown on the icon and in the chat header. The icon accepts an https:// URL or a data: URL; anything else shows our mark.
headerTitleString?SensibleStatsThe chat's title.
radiusdouble?16Corner radius of the chat, in px. Negative or non-finite values are dropped.
pinIconPinIcon?: pin, star, bookmarkpinThe icon visitors tap to follow a match or price.
launcherbooltruefalse hides our icon and teaser so you draw your own (section 8).
positionPosition: left, rightrightWhich bottom corner the icon sits in.
offsetLauncherOffsetLauncherOffset(x: 20, y: 20)Distance of the icon from the side and from the bottom of the safe area, in logical pixels.
launcherLabelString?"Chat with SensibleStats", localizedThe icon's label for screen readers. Blank counts as unset. Until the page answers, the icon's label is English "Open chat".

Slip, callbacks and events#

FieldTypeDefaultWhat it does
slipSportsList<SlipSport>?: basketball, americanfootball, tennisnoneThe sports your onAddToSlip accepts besides football. Section 7.
eventTextboolfalseAdds the visitor's question text to question_asked events. Answer text is never sent.

A string setting left null or blank is not sent, and the default applies.

Pass these callbacks to the controller's constructor, or set them later: each is a property you can change at any time.

PropertyDart typeWhat it does
onAddToSlipFuture<SlipResult?> Function(Selection selection)?Adds a price to your bet slip. Section 7.
onTeaservoid Function(Teaser? teaser)?Gives you the teaser to draw yourself. Section 8.
onUnavailablevoid Function(UnavailableReason reason)?Tells you the chat cannot start. Section 11.
onEventvoid Function(Map<String, Object?> event)?Every widget event, for your own analytics. Section 9.
onBridgeMessagevoid Function(BridgeDirection direction, String json)?Every raw message between the page and your app, for debugging. direction is pageToApp or appToPage. An error thrown here is ignored.

5. The signed-in visitor#

Pass your id for the signed-in visitor in UserContext(operatorUserId: ...). Use a random, non-guessable id that never changes for that account and that you map to the customer on your side (a UUID works). Never use a customer number, email address or name: the id comes from the visitor's device, and anyone who knows it can act as that visitor. Spaces at either end are trimmed.

A signed-in visitor is required in the app. With an empty operatorUserId, the chat does not start, no icon appears, and onUnavailable receives UnavailableReason.noUser.

With the id, the visitor's chat, followed matches and favourites belong to their account, and the greeting can lead with the teams and markets they bet on.

When the visitor signs in or switches account, call reload with a config for the new id:

Dart
_chat.reload(chatConfig(newUserId));

When the visitor signs out, reload with an empty id, or dispose() the controller. After the reload the chat closes, the icon hides and onUnavailable receives noUser:

Dart
_chat.reload(chatConfig(''));

reload keeps the same controller. It loads the page again for the new visitor and drops anything not yet delivered to the old page. The teaser clears and the icon hides until the new page is ready; if the chat sheet was open, it stays open on the new visitor's chat. The new config must have the same baseUrl origin, or reload throws an ArgumentError.

6. The page the visitor is on#

Tell the chat which screen it sits on and the greeting leads with that game, competition or sport. Set page in the config, or call setPage when the visitor moves between screens.

Dart
_chat.setPage(const PageContext(
  sport: Sport.football,
  kind: PageKind.match,
  matchId: PageId.number(19432556),
));

PageContext

FieldTypeMeaning
sportSport: football, basketball, americanfootball, tennisRequired.
kindPageKind?: section, competition, matchA sport's front page, a competition page, or a match page.
matchIdPageId?Your sportsbook's id for the match on a match page.
competitionIdPageId?Your sportsbook's id for the competition on a competition page.

PageId holds a number or a string: PageId.number(19432556) or PageId.text('abc-123').

Call setPage(null) on a screen that is about no sport. If the visitor has not typed or tapped anything yet, the chat greets again for the new page.

setPage only tells the page that is loaded now. After reload the chat starts from config.page, so put the current screen in the config you reload with.

7. Add to slip#

The chat shows your prices, each with an "Add to slip" button. This is how a tap reaches your slip:

  1. The visitor taps "Add to slip" under a price.
  2. The controller calls onAddToSlip(selection). selection.matchOddsId is your sportsbook's own id for that selection, so you can look it up directly.
  3. Your code adds that selection to your slip and returns a SlipResult.
  4. The chat shows the visitor a short note in their language, such as "Added to slip".
Dart
Future<SlipResult?> _addToSlip(Selection selection) async {
  final outcome = await mySlip
      .add(selection.matchOddsId)
      .timeout(const Duration(seconds: 9));
  switch (outcome) {
    case MySlipOutcome.added:
      return SlipResult.added();
    case MySlipOutcome.alreadyThere:
      return SlipResult.duplicate();
    case MySlipOutcome.suspended:
      return SlipResult.rejected(RejectReason.suspended);
    default:
      return SlipResult.rejected(RejectReason.notFound);
  }
}

You have 10 seconds to answer. No answer in time counts as a failure: the visitor sees "Couldn't add to slip. Try again." We don't cancel your handler at 10 seconds, so give your slip call its own timeout under 10 seconds, as above; the TimeoutException it throws is answered with unsupported.

The button shows even when onAddToSlip is not set. A tap then gets rejected with unsupported. The same happens when your handler throws.

What the controller sends: Selection

FieldTypeMeaning
matchOddsIdintYour sportsbook's id for the selection. Look it up in your slip.
matchIdintYour sportsbook's id for the match.
oddsDecimaldoubleThe price the visitor saw, as a decimal.
sportSport?null (or football) means football. basketball, americanfootball or tennis otherwise.
tourString?Tennis only: the tour the match id belongs to.
oddsSlipOdds?The same price in your account's odds format (not the visitor's own choice): format (e.g. "american") and text (e.g. "+150").
quotedAtUtcString?ISO time when that price was last confirmed.
conversationId, insightIdString?Which chat and which card the tap came from.
displaySlipDisplay?The pick in words, for showing only: home, away, kickoffUtc, market, marketLabel, selection, line, player, each a String?. Never price or settle a bet from these.

Every field after tour is optional: one the page leaves out or sends with the wrong type is null and never stops the selection reaching you. A selection that lacks matchOddsId, matchId or oddsDecimal never reaches your handler; the wrapper answers unsupported for you.

What you return: SlipResult

ReturnWhenThe visitor sees (English)
SlipResult.added() or nullThe selection is in the slip. added also takes slip: SlipSummary(selectionCount: ..., totalOddsDecimal: ...); it is accepted but not shown today.Added to slip
SlipResult.duplicate()It was already in the slip.Already in your slip
SlipResult.priceChanged(newOdds: '2.10', accepted: true)The price moved and you added it at the new price. newOdds is the new price as text; empty text throws an ArgumentError.Added at 2.10 (was 1.95)
SlipResult.priceChanged(newOdds: '2.10', accepted: false)The price moved and you did not add it.Price moved to 2.10 (was 1.95). Tap to add.
SlipResult.rejected(reason, message: ...)You did not add it. reason is a RejectReason below; message is optional.See below
RejectReasonMeaningThe visitor sees (English)
loginRequiredThe visitor must sign in first.Sign in to add to your slip
suspendedThe market is suspended.Market suspended
closedThe market or match is closed, e.g. it has started.Your message, else "This selection can't be added."
notFound, limit, unsupportedYou don't know this selection; the slip is full or a limit is reached; you don't take this kind of selection.Your message, else "Couldn't add to slip. Try again."

Other languages show the same notes, translated. message is your own text, shown as is: write it in the visitor's language. It is ignored for loginRequired and suspended.

Other sports. Football prices get the button straight away. Basketball, American football and tennis prices get it only when slipSports lists that sport, so a handler that only knows football never receives them:

Dart
slipSports: [SlipSport.basketball, SlipSport.tennis],

For these sports the prices come from our own data, so matchOddsId and matchId are our ids, not your sportsbook's. Find the selection from display (teams, kick-off, market, selection and line) and tour for tennis, and return SlipResult.rejected(RejectReason.notFound) when you cannot.

Telling the chat what happened next (optional). These calls help the chat track your slip. Calls made before the page is ready are kept and sent once it is.

CallWhen
slipRemoved(SlipRef(matchOddsId: id, sport: sport))The visitor removed a selection from your slip.
betPlaced([SlipRef(matchOddsId: id)], stake: 10, currency: 'EUR', betId: 'B123', betType: 'single', totalOdds: 2.5)The visitor placed a bet. Only the selections are required; the rest are optional named arguments, and a non-finite stake or totalOdds is left out.
matchOpened(matchId)The visitor opened a match screen. matchId is an int.

SlipRef has matchOddsId (int, required) and sport (Sport?; leave it null for football).

8. The icon and teaser#

By default SensibleStatsLauncher draws the icon and teaser. It shows nothing until the chat page is ready, hides while the chat sheet is open, and shows nothing when the chat cannot start. The icon is 56 logical pixels; the teaser is up to 240 wide.

To draw them yourself, in your app's design, set launcher: false in the config. The launcher widget then draws nothing, and you read the teaser from the controller:

Dart
_chat.onTeaser = (teaser) {
  if (teaser == null) return myLauncher.hideTeaser();
  myLauncher.showTeaser(teaser.text, teaser.asks, teaser.price);
  _chat.teaserShown();
};
myLauncher.onIconTap = () => _chat.open(context);

onTeaser receives a Teaser when one arrives or changes, and null when it is gone. It is not called at start-up while there is no teaser. The current teaser is also in _chat.teaser, and the controller is a ChangeNotifier, so a ListenableBuilder on it rebuilds when the teaser changes. Show your icon only while _chat.available is true.

Teaser

FieldTypeMeaning
textString?The greeting line.
asksList<TeaserAsk>Suggested questions. Each has index (int) and label (String). Show label; pass index to tapAsk.
ctaString?A button label, e.g. "Build a bet".
priceTeaserPrice?One price: matchOddsId (int), marketLabel (the market's name), label (the selection's name) and odds (the price as text).

Call these when the visitor acts on your teaser. Each one that opens the chat needs a BuildContext under your Navigator.

CallWhenWhat the controller does
teaserShown()You showed the teaser.Counts it as seen, once per teaser, only while the chat is ready and the sheet is closed.
tapTeaser(context)The visitor tapped the teaser text.Clears the teaser and opens the chat.
tapAsk(index, context)The visitor tapped a suggested question.Clears the teaser, opens the chat and asks it.
tapCta(context)The visitor tapped the button.Clears the teaser and opens the chat on it.
tapPrice()The visitor tapped the price.Checks the price again, then calls your onAddToSlip. Returns Future<PriceResult?>.
dismissTeaser()The visitor closed the teaser.Clears it; onTeaser(null) follows.

Opening the chat by any route also clears the teaser. These calls work while our own launcher is on screen too.

PriceResult has matchOddsId (int), outcome (PriceOutcome) and text (String?, the note to show the visitor, or null).

outcome is added (the selection is in the slip: added, already there, or added at a new price), gone (the price is no longer offered), coolOff (too many requests; try again shortly) or failed (not added: your handler refused it or did not answer).

tapPrice() completes with null when there is no price, when an earlier tap is still waiting, when the teaser is replaced or dismissed, when no answer comes within 15 seconds, or when the chat is reloaded or disposed. Our own launcher greys the price out while a tap is waiting and shows text under it.

9. Events for your analytics#

Every visitor action in the chat is passed to onEvent as a Map<String, Object?>, so you can forward it to your own analytics. The chat does not check consent; gate your own sending on it.

Every event carries name, at (epoch ms, when it happened), operatorId and widgetVersion, and when known language, conversationId, operatorUserId and page. A ? marks a field that can be absent.

EventFields
widget_opensource? (launcher, bubble, teaser, host, popup), first?
widget_closemethod (button, escape, host for your close(), native, back), tab, answering, openMs?
bubble_shown, bubble_click, bubble_dismissnone
bubble_ask_clickposition
tab_changefrom, to, source? (bar, link, auto)
question_askedturnId, source, length, text? (only with eventText), method?, chipId?, position?, actionRef?, retryOf?, matchId?
answer_receivedturnId, conversationId, latencyMs, cardTypes, firstByteMs?
answer_failedturnId, code
answer_stoppedturnId
add_to_slip_clickmatchOddsId, matchId, odds, market?, sport?, factKey?, surface?, turnId?
add_to_slip_resultthe same fields, plus outcome
pin_clickaction (add, remove), target (match, market), matchId?, market?, sport?, surface?, turnId?
combo_add_clicksurface (builder, chat), sport, legs, total, turnId?
combo_variant_clicksurface, sport, legs, total, variant
combo_swap_clicksurface, sport, legs, total
all_markets_clickmatchId, market?, surface
dashboard_tile_clickentityType, entityId
sport_switchsport
new_conversationnone
favourite_changekind, id, outcome, sport?, surface?, before?

add_to_slip_result.outcome is added, duplicate, price_changed, timeout or the reject reason you returned, in snake case (login_required, suspended, closed, not_found, limit, unsupported). timeout covers any failed add, not only a late one. odds in events is always a decimal number.

tab, from and to are one of chat, live, matches, builder, following, trends, games, fixtures, standings, squad, records. question_asked.source is one of typed, starter, action, tile, preset, live_fact, bubble_ask, retry, match_sheet.

10. Colours#

Each theme has four colours, set with ThemeColors. A colour you leave out keeps ours. The dark theme reads only the dark colours, never the light ones.

ColourUsed forLight defaultDark default
accentYour brand colour: links, highlights and the teaser's questions.#17936a#37c891
ctaPrice and "Add to slip" buttons, and the teaser's price and button.#f5a623#ffb638
surfaceThe chat's background, the icon and the teaser.#ffffff#141b24
inkText.#14181d#e8edf2

Colours must be hex: #rgb, #rrggbb or #rrggbbaa. Any other value is dropped and our colour applies; in a debug build the console says which one.

Set surface and ink together: the teaser, lines and faint text are then mixed from them.

Dart
colors: const ChatColors(
  light: ThemeColors(accent: '#0b5fff', cta: '#ffcc00'),
  dark: ThemeColors(accent: '#5c93ff', cta: '#ffd633', surface: '#0d1117', ink: '#f0f3f6'),
),

ThemeColors has four optional String? fields, accent, cta, surface and ink. ChatColors has two ThemeColors? fields, light and dark.

Which group the icon uses: the theme the chat page reports (_chat.pageTheme, a PageTheme of light or dark); before the page reports one, theme from the config, and for auto the device's brightness.

11. When the chat cannot start#

_chat.available turns true when the page loads, and back to false if our server then refuses the chat, so the icon can show for a moment before it hides. When the page reports one of the reasons below, the controller closes the chat sheet (even with one of your dialogs on top of it), hides the icon, clears the teaser and sets _chat.unavailableReason. It then calls onUnavailable(reason), once for each new reason: the same reason reported again does not call it twice. A reason this version of the wrapper does not know only hides the icon.

UnavailableReasonCauseFix
noUseroperatorUserId is empty, for example after sign-out.Start the chat only for a signed-in visitor (section 5).
mobileDisabledMobile is not switched on for your account.Ask your SensibleStats contact to switch mobile on for your account.
widgetDisabledThe widget is off for your account, or the operator id is not one we know.Check the id. If it is right, ask your contact to switch the widget on.
authFailedThe public key is wrong or empty, or the operator id is empty.Check both values.

Errors you can see in your own code:

ErrorCause
ArgumentError from the SensibleStatsChatController constructor, "must be an https URL with a host"baseUrl is not an https URL.
ArgumentError from reload, "reload() keeps the gateway origin"The new config has a different baseUrl origin.
ArgumentError from SlipResult.priceChanged, "must not be empty"newOdds is empty.

The controller retries the page once in all. If the page fails to load, it tries again after 1.5 seconds; if it loads but does not become ready within 5 seconds, it loads it again. After that one retry, a page that still fails leaves the icon hidden until you call reload.

12. Platform notes#

  • The chat sheet. open(context) shows a full-height modal bottom sheet inside the safe area, with a drag handle. Only the handle drags the sheet down, so scrolling the chat never closes it. The page, the visitor's draft and the conversation survive a close.
  • Back. System back, and a tap on the strip above the sheet, go to the chat first: if the chat has something of its own to close, it does; otherwise the sheet closes within 300 ms.
  • Keyboard. The sheet shrinks to stay above the keyboard. Closing the sheet hides the keyboard.
  • External links. A link to another site, or a mailto: or tel: link, opens outside your app through url_launcher. Other link types are blocked. The WebView only ever shows our page.
  • WebView access. On Android, file and content access in the WebView are off. In debug builds the WebView can be inspected (Chrome on Android, Safari on iOS).
  • Renderer crashes. The operating system can kill the process that draws a WebView, for example when memory runs low. The controller then loads the page again and, if the sheet was open, reopens the chat. If it happens a second time while the same sheet is open, it closes the sheet.
    • iOS recovers this way on its own.

    • Android needs one more file, RendererGuard.kt, which your SensibleStats contact sends you. Put it in your app's Kotlin source folder, change its first line to your app's package, and register it in MainActivity:

      Kotlin
      import io.flutter.embedding.android.FlutterActivity
      import io.flutter.embedding.engine.FlutterEngine
      
      class MainActivity : FlutterActivity() {
          override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
              super.configureFlutterEngine(flutterEngine)
              flutterEngine.plugins.add(RendererGuardPlugin())
          }
      }

      The guard works on Android 8.0 (API 26) and later. Without the file, or on older versions, the chat works normally, but a renderer crash is not recovered and Android ends your app.

13. Reference#

SensibleStatsChatController is a ChangeNotifier. After dispose() every method does nothing.

Read-only state

PropertyTypeMeaning
availableboolThe chat page is ready. false before then, after reload, and when it cannot start.
unavailableReasonUnavailableReason?Why the chat cannot start, or null.
isOpenboolThe chat sheet is open.
teaserTeaser?The current teaser, or null.
pageThemePageTheme?The theme the chat page is showing, light or dark; null until it reports one.
labelsLauncherLabels?The icon's and dismiss button's labels in the visitor's language (launcher, dismiss); null until the page sends them.
configSensibleStatsConfigThe config in use.

Methods

MethodReturnsWhat it does
open(BuildContext context)Future<void>Opens the chat sheet. Completes when the sheet closes. Does nothing if it is already open.
close()voidCloses the chat sheet.
reload(SensibleStatsConfig config)voidStarts again with a new config, for a new visitor (section 5).
setPage(PageContext? page)voidSets the page (section 6); null clears it.
dispose()voidStops the controller (section 3).
slipRemoved(SlipRef), betPlaced(List<SlipRef>, {stake, currency, betId, betType, totalOdds}), matchOpened(int)voidSection 7.
teaserShown(), tapTeaser(context), tapAsk(index, context), tapCta(context), dismissTeaser()voidSection 8.
tapPrice()Future<PriceResult?>Section 8.

Callback properties: section 4. wrapperVersion: section 3.