This example uses the ThoughtSpot Flutter Embed SDK to integrate ThoughtSpot analytics into Flutter applications.
This example demonstrates how to embed a ThoughtSpot Liveboard using the Flutter Embed SDK in a Flutter application. It covers authentication, custom theming, and interaction using host and embed events.
Demonstrates how to customize ThoughtSpot UI using custom CSS variables:
customCSS: customCssInterface(
variables: {
"--ts-var-root-background": "#f6f641",
"--ts-var-root-color": "#041a45",
"--ts-var-viz-background": "#38f193",
"--ts-var-viz-border-radius": "20px",
},
),Programmatically control the embedded Liveboard by sending host events to it:
// Reload the Liveboard
liveboardEmbedController.trigger(HostEvent.Reload);
// Switch to a specific tab
liveboardEmbedController.trigger(HostEvent.SetActiveTab, {
'tabId': ThoughtSpotConst.tabId,
});Listen for events emitted by the embedded content and handle them:
liveboardEmbedController.on(EmbedEvent.Data, (payload) {
print('Data event received: ${payload['displayMode']}');
});main.dart: Main app file with ThoughtSpot embedding logicpubspec.yaml: Project dependencies and metadata
-
Clone or copy this project.
-
Update ThoughtSpot details in
main.dart:
static const String host = 'https://<your-thoughtspot-host>';
static const String username = '<your-username>';
static const String password = '<your-password>';
static const String liveboardId = '<your-liveboard-id>';
static const String tabIdOne = '<your-tab-id>';
static const String tabIdTwo = '<your-tab-id>';- Install dependencies:
flutter pub get- Run the app:
flutter run- Flutter
- Dart
- Mobile/Web
