Skip to content

Latest commit

 

History

History
103 lines (73 loc) · 2.73 KB

README.md

File metadata and controls

103 lines (73 loc) · 2.73 KB

ThoughtSpot Flutter Embed Example

This example uses the ThoughtSpot Flutter Embed SDK to integrate ThoughtSpot analytics into Flutter applications.

Preview

Flutter ThoughtSpot Embed Demo

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.

Features

Custom Styles using CSS Variables

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",
  },
),

Host Events using trigger()

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,
});

Embed Events using on()

Listen for events emitted by the embedded content and handle them:

liveboardEmbedController.on(EmbedEvent.Data, (payload) {
  print('Data event received: ${payload['displayMode']}');
});

Code Structure

  • main.dart: Main app file with ThoughtSpot embedding logic
  • pubspec.yaml: Project dependencies and metadata

How to Use

  1. Clone or copy this project.

  2. 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>';
  1. Install dependencies:
flutter pub get
  1. Run the app:
flutter run

Documentation

Technology Stack

  • Flutter
  • Dart
  • Mobile/Web