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:
dependencies:
flutter:
sdk: flutter
sankofa_flutter: ^0.2.2Then fetch it:
flutter pub get2. Platform setup
The native SDKs underneath have light platform requirements that must be satisfied for the build to succeed.
iOS — bump the minimum platform
Open
ios/Podfileand ensure the iOS target is at least 13.0:rubyios/Podfileplatform :ios, '13.0'Then run:
bashcd ios && pod installAndroid — bump minSdk to 24
In
android/app/build.gradle.kts(orbuild.gradle):Kotlinandroid/app/build.gradle.ktsandroid { defaultConfig { minSdk = 24 targetSdk = 35 } }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.
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:
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
apiKeyStringRequiredendpointStringdefault https://api.sankofa.devdebugbooldefault falsetrackLifecycleEventsbooldefault trueenableAnalytics / enableCatch / enableFlags / enableConfig / enablePulsebooldefault trueenableSessionReplaybooldefault true4. Verify the install
Drop one track call somewhere reachable — for example in main() after init, or behind a button:
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.