LDClient class Null safety

The main interface for the LaunchDarkly Flutter SDK.

To setup the SDK before use, build an LDConfig with LDConfigBuilder and an initial LDContext with LDContextBuilder. These should be passed to LDClient.start(config, context) to initialize the SDK instance. A basic example:

builder = LDContextBuilder();
builder.kind("user", <USER_KEY>);
builder.kind("company", <COMP_KEY>);
context = builder.build();
LDClient.start(config, context)

After initialization, the SDK can evaluate feature flags from the LaunchDarkly dashboard against the current context, record custom events, and provides various status configuration and monitoring utilities. See the individual class and method documentation for more details.

Properties

hashCode int
The hash code for this object.
read-onlyinherited
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent 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 Methods

allFlags() Future<Map<String, LDValue>>
Returns a map of all feature flags for the current context, without sending evaluation events to LaunchDarkly.
boolVariation(String flagKey, bool defaultValue) Future<bool>
Returns the value of flag flagKey for the current context as a bool.
boolVariationDetail(String flagKey, bool defaultValue) Future<LDEvaluationDetail<bool>>
Returns the value of flag flagKey for the current context as a bool, along with information about the resultant value.
close() Future<void>
Permanently shuts down the client.
doubleVariation(String flagKey, double defaultValue) Future<double>
Returns the value of flag flagKey for the current context as a double.
doubleVariationDetail(String flagKey, double defaultValue) Future<LDEvaluationDetail<double>>
Returns the value of flag flagKey for the current context as a double, along with information about the resultant value.
flush() Future<void>
Triggers immediate sending of pending events to LaunchDarkly.
getConnectionInformation() Future<LDConnectionInformation?>
Returns information about the current state of the SDK's connection to the LaunchDarkly.
identify(LDContext context) Future<void>
Changes the active context.
intVariation(String flagKey, int defaultValue) Future<int>
Returns the value of flag flagKey for the current context as an int.
intVariationDetail(String flagKey, int defaultValue) Future<LDEvaluationDetail<int>>
Returns the value of flag flagKey for the current context as an int, along with information about the resultant value.
isInitialized() bool
Checks whether the SDK has completed starting.
isOffline() Future<bool>
Returns whether the SDK is currently configured not to make network connections.
jsonVariation(String flagKey, LDValue defaultValue) Future<LDValue>
Returns the value of flag flagKey for the current context as an LDValue.
jsonVariationDetail(String flagKey, LDValue defaultValue) Future<LDEvaluationDetail<LDValue>>
Returns the value of flag flagKey for the current context as an LDValue, along with information about the resultant value.
registerFeatureFlagListener(String flagKey, LDFlagUpdatedCallback flagUpdateCallback) Future<void>
Registers a callback to be notified when the value of the flag flagKey is updated.
registerFlagsReceivedListener(LDFlagsReceivedCallback flagsReceivedCallback) Future<void>
Registers a callback to be notified when flag data is received by the SDK.
setOnline(bool online) Future<void>
Shuts down or restores network activity made by the SDK.
start(LDConfig config, LDContext context) Future<void>
Initialize the SDK with the given LDConfig and LDContext.
startFuture({Duration? timeLimit}) Future<void>
Returns a future that completes when the SDK has completed starting.
stringVariation(String flagKey, String defaultValue) Future<String>
Returns the value of flag flagKey for the current context as a string.
stringVariationDetail(String flagKey, String defaultValue) Future<LDEvaluationDetail<String>>
Returns the value of flag flagKey for the current context as a string, along with information about the resultant value.
track(String eventName, {LDValue? data, num? metricValue}) Future<void>
Track custom events associated with the current context for data export or experimentation.
unregisterFeatureFlagListener(String flagKey, LDFlagUpdatedCallback flagUpdateCallback) Future<void>
Unregisters an LDFlagUpdatedCallback from the flagKey flag.
unregisterFlagsReceivedListener(LDFlagsReceivedCallback flagsReceivedCallback) Future<void>
Unregisters an LDFlagsReceivedCallback.