Interface IFlagTracker
An interface for tracking changes in feature flag configurations.
Namespace: LaunchDarkly.Sdk.Client.Interfaces
Assembly: LaunchDarkly.ClientSdk.dll
Syntax
public interface IFlagTracker
Remarks
An implementation of this interface is returned by FlagTracker. Application code never needs to implement this interface.
Events
| Edit this page View SourceFlagValueChanged
An event for receiving notifications of feature flag changes.
Declaration
event EventHandler<FlagValueChangeEvent> FlagValueChanged
Event Type
Type | Description |
---|---|
EventHandler<FlagValueChangeEvent> |
Remarks
This event is raised whenever the SDK receives a variation for any feature flag that is not equal to its previous variation. This could mean that the flag configuration was changed in LaunchDarkly, or that you have changed the current user and the flag values are different for this user than for the previous user. The event is not raised if the SDK has just received its very first set of flag values.
Currently this event will not fire in a scenario where 1. the client is offline, 2. Identify(Context, TimeSpan) or IdentifyAsync(Context) has been called to change the current user, and 3. the SDK had previously stored flag data for that user (see PersistenceConfigurationBuilder) and has now loaded those flags. The event will only fire if the SDK has received new flag data from LaunchDarkly or from TestData.
Notifications will be dispatched either on the main thread (on mobile platforms) or in a background task (on all other platforms). It is the listener's responsibility to return as soon as possible so as not to block subsequent notifications.
Examples
client.FlagTracker.FlagChanged += (sender, eventArgs) => { System.Console.WriteLine("flag '" + eventArgs.Key + "' changed from " + eventArgs.OldValue + " to " + eventArgs.NewValue); };