SDKsOfficial
Initialization
Initialize the Flutter SDK correctly, choose the right endpoint form, and wire the common setup flags.
Source of truth
sdk/sankofa_flutter/README.mdexamples/flutter_example/lib/main.dartsdk/sankofa_flutter/lib/sankofa_flutter.dartBasic initialization
await Sankofa.instance.init(
apiKey: 'sk_live_12345',
endpoint: 'http://localhost:8080',
debug: true,
);
Full example from the example app
await Sankofa.instance.init(
apiKey: key,
endpoint: url,
debug: _debugMode,
trackLifecycleEvents: _trackLifecycleEvents,
enableSessionReplay: _enableSessionReplay,
replayMode: _replayMode,
);
Endpoint normalization
The SDK accepts several endpoint shapes and normalizes them internally:
endpoint: 'http://localhost:8080'Internally:
resolveServerBaseUri(endpoint)derives the engine base URLresolveTrackUri(endpoint)derives the final track URL
Common flags
| Flag | Purpose |
|---|---|
debug | Enables SDK log output during development. |
trackLifecycleEvents | Enables automatic lifecycle tracking when supported by the SDK. |
enableSessionReplay | Turns replay collection on and configures replay helpers. |
replayMode | Selects wireframe or screenshot replay behavior. |
Initialization order
- 1
Ensure Flutter bindings are ready
Call `WidgetsFlutterBinding.ensureInitialized()` before you initialize the SDK.
- 2
Initialize before runApp
This ensures tracking, identity, and replay configuration are ready as the app tree mounts.
- 3
Wrap replay-aware UI when needed
If replay is enabled, place `SankofaReplayBoundary` near the root and add `SankofaNavigatorObserver()` to the app navigator.