DocsSDKsFlutter API reference
SDKsOfficial

Flutter API reference

Reference for the public Sankofa Flutter methods and the endpoint normalization helpers used by the SDK.

Source of truthsdk/sankofa_flutter/lib/sankofa_flutter.dartsdk/sankofa_flutter/lib/src/replay/sankofa_replay.dart

Core instance methods

init

Future<void> init({
required String apiKey,
required String endpoint,
bool debug = false,
bool trackLifecycleEvents = true,
bool enableSessionReplay = false,
SankofaReplayMode replayMode = SankofaReplayMode.wireframe,
})

Initializes the SDK, resolves endpoint URLs, loads persisted identity and queue state, gathers default properties, and prepares replay when enabled.

track

Future<void> track(
String eventName, [
Map<String, dynamic>? properties,
])

Refreshes the current session, serializes event properties, injects $session_id, adds default properties, and appends the event to the local queue.

identify

Future<void> identify(String userId)

Switches the active distinct ID to a known user and queues an alias item when the previous identity differs.

peopleSet

Future<void> peopleSet(Map<String, dynamic> properties)

Queues a people profile update for the active distinct ID using the transport serializer.

reset

Future<void> reset()

Flushes pending events, clears the current user ID, creates a new anonymous ID, rotates the session, and reconfigures replay if enabled.

Endpoint helpers

resolveServerBaseUri

static Uri resolveServerBaseUri(String endpoint)

Normalizes an endpoint string back to the engine base URL, even when the input points at /api/v1 or /api/v1/track.

resolveTrackUri

static Uri resolveTrackUri(String endpoint)

Normalizes the final track URL so the SDK always targets the v1 track endpoint.

Replay helpers

SankofaReplayBoundary

const SankofaReplayBoundary({
super.key,
required Widget child,
})

Provides the replay capture boundary used by the replay subsystem when replay is enabled.

SankofaNavigatorObserver

class SankofaNavigatorObserver extends RouteObserver<PageRoute<dynamic>>

Observes route changes so replay metadata can follow navigation flow inside the app.