Class FeatureFlagsState
A snapshot of the state of all feature flags with regard to a specific user. See calling AllFlagsState(Context, params FlagsStateOption[]).
Implements
Inherited Members
Namespace: LaunchDarkly.Sdk.Server
Assembly: LaunchDarkly.ServerSdk.dll
Syntax
[JsonConverter(typeof(FeatureFlagsStateConverter))]
public class FeatureFlagsState : IJsonSerializable
Remarks
Serializing this object to JSON using System.Text.Json
or LdJsonSerialization
will produce the appropriate data structure for bootstrapping the LaunchDarkly JavaScript client.
Using Newtonsoft.Json
will not work correctly without special handling; see
LaunchDarkly.Sdk.Json for details.
Properties
| Edit this page View SourceValid
True if this object contains a valid snapshot of feature flag state, or false if the state could not be computed (for instance, because the client was offline or there was no user).
Declaration
public bool Valid { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
| Edit this page View SourceBuilder(params FlagsStateOption[])
Returns a builder for constructing a new instance of this class. May be useful in testing.
Declaration
public static FeatureFlagsStateBuilder Builder(params FlagsStateOption[] options)
Parameters
Type | Name | Description |
---|---|---|
FlagsStateOption[] | options | the same options that can be passed to AllFlagsState(Context, params FlagsStateOption[]) |
Returns
Type | Description |
---|---|
FeatureFlagsStateBuilder | a new FeatureFlagsStateBuilder |
Equals(object)
Declaration
public override bool Equals(object other)
Parameters
Type | Name | Description |
---|---|---|
object | other |
Returns
Type | Description |
---|---|
bool |
Overrides
| Edit this page View SourceGetFlagReason(string)
Returns the evaluation reason of an individual feature flag (as returned by BoolVariation(string, Context, bool), etc.) at the time the state was recorded.
Declaration
public EvaluationReason? GetFlagReason(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | the feature flag key |
Returns
Type | Description |
---|---|
EvaluationReason? | the evaluation reason; null if reasons were not recorded, or if there was no such flag |
GetFlagValueJson(string)
Returns the value of an individual feature flag at the time the state was recorded.
Declaration
public LdValue GetFlagValueJson(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | the feature flag key |
Returns
Type | Description |
---|---|
LdValue | the flag's JSON value; Null if the flag returned the default value, or if there was no such flag |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int |
Overrides
| Edit this page View SourceToValuesJsonMap()
Returns a dictionary of flag keys to flag values.
Declaration
public IReadOnlyDictionary<string, LdValue> ToValuesJsonMap()
Returns
Type | Description |
---|---|
IReadOnlyDictionary<string, LdValue> | a dictionary of flag keys to flag values |
Remarks
If a flag would have evaluated to the default value, its value will be Null.
Do not use this method if you are passing data to the front end to "bootstrap" the
JavaScript client. Instead, serialize the FeatureFlagsState object to JSON
using JsonConvert.SerializeObject()
.