Install

Install on Flutter

Install the Sankofa Flutter SDK from pub.dev and initialize it before runApp — works on iOS, Android, web, and desktop targets.

The sankofa_flutter package on pub.dev bundles all seven Sankofa products in a single SDK — Analytics, Catch (error tracking), Switch (feature flags), Config (remote config), Pulse (surveys), Replay (session replay), and Deploy (App-Store-compliant OTA updates).

1. Add the dependency

Add sankofa_flutter to your pubspec.yaml:

YAMLpubspec.yaml
dependencies:
flutter:
  sdk: flutter
sankofa_flutter: ^0.2.2

Then fetch it:

bash
flutter pub get

2. Platform setup

The native SDKs underneath have light platform requirements that must be satisfied for the build to succeed.

  1. iOS — bump the minimum platform

    Open ios/Podfile and ensure the iOS target is at least 13.0:

    rubyios/Podfile
    platform :ios, '13.0'

    Then run:

    bash
    cd ios && pod install
  2. Android — bump minSdk to 24

    In android/app/build.gradle.kts (or build.gradle):

    Kotlinandroid/app/build.gradle.kts
    android {
      defaultConfig {
          minSdk = 24
          targetSdk = 35
      }
    }
  3. Web (optional)

    Web targets work out of the box; no extra step is needed.

3. Initialize before runApp

Initialize the SDK in main() before the first frame so device metadata is captured from the very first event.

Dartlib/main.dart
import 'package:flutter/material.dart';
import 'package:sankofa_flutter/sankofa_flutter.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Sankofa.instance.init(
  apiKey: const String.fromEnvironment('SANKOFA_KEY'),
  endpoint: 'https://api.sankofa.dev',
  debug: !const bool.fromEnvironment('dart.vm.product'),
);
runApp(const MyApp());
}

Pass the API key at build time with --dart-define:

bash
flutter run --dart-define=SANKOFA_KEY=sk_test_...

That single call brings up every product — Analytics, Catch, Switch, Config and Pulse all default on (each gated server-side, so untouched products stay dormant). See the Flutter SDK overview for the full parameter list and how to turn individual products off.

Common init flags

apiKeyStringRequired
Your project's API key (live or test). The engine resolves the environment from the key on every request.
endpointStringdefault https://api.sankofa.dev
Server base URL. Use a regional endpoint to pin data residency.
debugbooldefault false
Verbose logging during development. Disable in production.
trackLifecycleEventsbooldefault true
Auto-track $app_opened, $app_foregrounded, $app_backgrounded.
enableAnalytics / enableCatch / enableFlags / enableConfig / enablePulsebooldefault true
Per-product master switches — all on by default. Set any to false to skip that product entirely.
enableSessionReplaybooldefault true
Capture session replays. You must still wrap your app in <SankofaReplayBoundary>.

4. Verify the install

Drop one track call somewhere reachable — for example in main() after init, or behind a button:

Dart
await Sankofa.instance.track('install_check', {'from': 'flutter-quickstart'});

Open app.sankofa.dev → your project → Live events. You should see the event within a few seconds, with a flutter source label.

What's next

Edit this page on GitHub