init static method
- LDClient client, {
- required ObservabilityOptions observability,
- SessionReplayOptions? replay,
Boots observability (and optional session replay) by registering the
internal plugin on an already-constructed LDClient. Mirrors
LDObserve.Init(LdClient client, ...).
When replay is omitted, session replay is not wired up.
The returned future completes with true once observability is ready.
Recording calls made before then are dropped (the most recent screen
view is the exception: it is replayed once ready), so await it before
recording anything that must not be lost. Awaiting is optional.
The future never completes with an error. It completes with false when
startup fails (the error is logged, and calling init again retries) or
after shutdown. Only the first successful init takes effect: a later
call is logged and ignored, including its options, and reports the first
call's outcome.
Implementation
static Future<bool> init(
LDClient client, {
required ObservabilityOptions observability,
SessionReplayOptions? replay,
}) {
final plugin = LDObservePlugin(observability, replay: replay);
client.registerPlugin(plugin);
return plugin.bootResult ?? Future.value(false);
}