Dart: Analytics and performance
Log events and screen views for active users, funnels and retention, and report app start, screen and network timings with the Dart and Flutter SDK.
Log events and screen views for active users, funnels and retention, and report app start, screen and network timings. Every call runs as the client's signed-in user, so your project's policies and row-level security apply. Types and members are listed in source order; each one links to its HTTP endpoint where it maps to one.
#Types and members
SovariaAnalytics
Product analytics: sovaria.analytics.track('purchase', {'amount': 20}), screen, identify, and setEnabled (false when the user opts out: the server then drops their events on every device). Events are batched (every 10 s or 20 events) and kept in the OfflineStore while offline; the signed-in user comes from the request's token on the server, never from the event.
class SovariaAnalyticsSovariaAnalytics.SovariaAnalytics
Create an instance.
SovariaAnalytics(this._client)SovariaAnalytics.appVersion
A property.
String? appVersionSovariaAnalytics.platform
A property.
String platformSovariaAnalytics.batchSize
A property.
int batchSizeSovariaAnalytics.flushInterval
A property.
Duration flushIntervalSovariaAnalytics.anonId
The device id sent as anon_id.
String get anonIdSovariaAnalytics.isEnabled
A property.
bool get isEnabledSovariaAnalytics.pending
A property.
int get pendingSovariaAnalytics.configure
Persist the queue, device id and opt-out across launches.
Future<void> configure({OfflineStore? store, String? appVersion, String? platform})SovariaAnalytics.track
bool track(String name, [Map<String, Object?> props = const {}])SovariaAnalytics.screen
bool screen(String name, [Map<String, Object?> props = const {}])SovariaAnalytics.identify
bool identify(Map<String, Object?> userProps)SovariaAnalytics.trackExposure
One $exposure per experiment and session (remote config calls this when you read an experiment's value).
void trackExposure(String experiment, String variant)SovariaAnalytics.flush
Send what is queued now.
Future<void> flush()Network errors and throttling keep the events; a refused batch is dropped.
SovariaAnalytics.setEnabled
Analytics consent (DPDP / GDPR).
Future<void> setEnabled(bool on, {bool erase = false})Off clears the queue and tells the server; erase also deletes what was stored.
SovariaRemoteConfig
Remote config and feature flags: setDefaults, fetchAndActivate, getBool/getString/getNumber/getJson and onUpdate (live after a publish when the plan has realtime config). Only this user's evaluated values come back (never the rules); unchanged config costs a 304; activated values persist for offline starts.
class SovariaRemoteConfigSovariaRemoteConfig.SovariaRemoteConfig
Create an instance.
SovariaRemoteConfig(this._client)SovariaRemoteConfig.minimumFetchInterval
A property.
Duration minimumFetchIntervalSovariaRemoteConfig.attributes
A property.
Map<String, Object?> attributesSovariaRemoteConfig.appVersion
A property.
String? appVersionSovariaRemoteConfig.platform
A property.
String platformSovariaRemoteConfig.language
A property.
String? languageSovariaRemoteConfig.setDefaults
void setDefaults(Map<String, Object?> values)SovariaRemoteConfig.onUpdate
Changed keys whenever new values are activated (listen to get live updates after a publish).
Stream<List<String>> get onUpdateSovariaRemoteConfig.configure
Restore the last activated values (call early with a durable store).
Future<void> configure({OfflineStore? store})SovariaRemoteConfig.fetchAndActivate
Fetch (respecting minimumFetchInterval unless force) and activate.
Future<bool> fetchAndActivate({bool force = false})True when values changed.
SovariaRemoteConfig.getBool
bool getBool(String key, {bool fallback = false})SovariaRemoteConfig.getString
String getString(String key, {String fallback = ""})SovariaRemoteConfig.getNumber
double getNumber(String key, {double fallback = 0})SovariaRemoteConfig.getJson
Object? getJson(String key)SovariaRemoteConfig.version
A property.
int get versionSovariaRemoteConfig.close
Future<void> close()SovariaPerf
Client performance monitoring (Observability › Performance in the console), the same measurements as the Swift and Kotlin clients:
- App start — call sovaria.perf.markAppReady(processStart: …) from the first frame (WidgetsBinding.instance.addPostFrameCallback); without processStart the time from install is used. - Screens — final t = sovaria.perf.screen('Checkout'); … t.end(); a NavigatorObserver that starts one per route is a few lines (see the docs). - Network — every request the SDK makes (method, route, status, duration) with the traceparent it sent, so a slow call opens the server trace for the same request. - Custom traces — await sovaria.perf.trace('sync', () => sync()).
Batched every 10 s (at most 100 per request); counts against obs.perf_events_month.
class SovariaPerfSovariaPerf.SovariaPerf
Create an instance.
SovariaPerf(this._client)SovariaPerf.installed
A property.
bool get installedSovariaPerf.timesNetwork
A property.
bool get timesNetworkSovariaPerf.install
void install({String? release, String? environment, double sampleRate = 1, bool network = true})SovariaPerf.uninstall
void uninstall()SovariaPerf.markAppReady
The first frame is on screen: records the cold start once per launch.
void markAppReady({DateTime? processStart})SovariaPerf.screen
PerfTrace screen(String name)SovariaPerf.trace
Future<T> trace<T>(String name, Future<T> Function() body, {Map<String, Object?> attributes = const {}})SovariaPerf.record
Queue one measurement; false when not installed or not sampled.
bool record(String kind, String name, double value, {String? route, String? traceId, Map<String, Object?> attributes = const {}})SovariaPerf.network
void network(String method, String path, int status, double ms, String traceId)SovariaPerf.flush
Send queued measurements now (a failed batch is dropped: monitoring never breaks the app).
Future<void> flush()PerfTrace
A running screen or custom trace; end records it once.
class PerfTracePerfTrace.end
void end()