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:
dependencies:
flutter:
sdk: flutter
sankofa_flutter: ^1.0.0Then 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_...Common init flags
apiKeyStringRequiredendpointStringdefault https://api.sankofa.devdebugbooldefault falsetrackLifecycleEventsbooldefault trueenableSessionReplaybooldefault false4. 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.