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 six Sankofa products in a single SDK — Analytics, Catch (error tracking), Switch (feature flags), Config (remote config), Pulse (surveys), and Replay (session replay). OTA Deploy is not exposed at the Dart API surface today; if you need OTA in a hybrid app, use the React Native SDK.

1. Add the dependency

Add sankofa_flutter to your pubspec.yaml:

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

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_...

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.
enableSessionReplaybooldefault false
Wrap your app in <SankofaReplayBoundary> to enable. See the replay guide.

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