LDObserve class final

Static facade for LaunchDarkly observability and session replay from Flutter. Mirrors the C# LaunchDarkly.Observability.LDObserve facade and is the single public entry point for both initialization and recording.

Fully usable on web and mobile: it only depends on cross-platform code (the platform abstraction and the Dart OpenTelemetry pipeline), never on the native bridge directly.

Dart does not support method overloading, so the two init variants are split into LDObserve.init (LaunchDarkly client backed) and LDObserve.initStandalone (standalone, no client) — matching the two Init(client, ...) / Init(mobileKey, ...) overloads in MAUI.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

nativeVersion → String
The native observability bridge version reported during startup, or an empty string before initialization (or on web, which has no native bridge).
no setter

Static Methods

init(LDClient client, {required ObservabilityOptions observability, SessionReplayOptions? replay}) → Future<bool>
Boots observability (and optional session replay) by registering the internal plugin on an already-constructed LDClient. Mirrors LDObserve.Init(LdClient client, ...).
initStandalone(String mobileKey, {required ObservabilityOptions observability, SessionReplayOptions? replay}) → Future<bool>
Boots observability (and optional session replay) standalone, without a LaunchDarkly client. Mirrors LDObserve.Init(string mobileKey, ...).
recordException(dynamic exception, {StackTrace? stackTrace, Map<String, Object?>? properties}) → void
Record an exception with an optional stack trace and properties.
recordLog(String message, {LogSeverity severity = LogSeverity.info, StackTrace? stackTrace, Map<String, Object?>? properties}) → void
Record a log with optional properties. Defaults severity to LogSeverity.info.
shutdown() → Future<void>
Shut down observability and session replay for the rest of the process.
startSpan(String name, {SpanKind kind = SpanKind.internal, Map<String, Object?>? properties}) → Span
Start a span with the given name and optional properties.
track(String eventName, {Map<String, Object?>? properties, num? metricValue}) → void
Record a custom track event as a track span.
trackClick({String? id, String? tag, String? text, double? x, double? y, Map<String, Object?>? properties}) → void
Record a click so it appears on the Session Replay timeline as a Click event and as a click span.
trackScreenView(String name, {String? screenClass, String? screenId, String? category, Map<String, Object?>? properties}) → void
Record a screen view (navigation) so it appears on the Session Replay timeline as a Navigate event and as a screen_view span.
withSpan<T>(String name, T fn(Span span), {SpanKind kind = SpanKind.internal, Map<String, Object?>? properties}) → T
Run fn inside a new span that ends automatically.
zoneSpecification() → ZoneSpecification
Get a zone specification which intercepts print statements.