Documentation Index
Fetch the complete documentation index at: https://launchdarkly-preview.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Client-side SDKs
This feature is available in the following client-side SDKs:- .NET (client-side)
- Android
- C++ (client-side)
- Electron
- Flutter
- iOS
- JavaScript
- Node.js (client-side)
- React Native
- Roku
.NET (client-side)
Expand .NET (client-side) code sample
Expand .NET (client-side) code sample
The To learn more about the
VariationDetail methods, such as BoolVariationDetail, work the same as Variation, but also provide additional “reason” information about how a flag value was calculated. For example, you can find out if the context was individually targeted for the flag or was matched by one of the flag’s rules. You can examine the “reason” data programmatically, or, if you capture detailed analytics events for flags, view it with Data Export.Here is an example:VariationDetail methods, read EvaluationDetail and BoolVariationDetail. To learn more about the configuration option, read EvaluationReasons.Android
Expand Android code sample
Expand Android code sample
The To learn more about the To learn more, read
variationDetail methods, such as boolVariationDetail, work the same as variation. They also provide additional “reason” information about how a flag value was calculated, such as if the context matched a specific rule. You can examine the “reason” data programmatically, or, if you capture detailed analytics events for flags, view it with Data Export.Here is an example:variationDetail methods, read EvaluationDetail and getVariationIndex. To learn more about the configuration option, read evaluationReasons.Here is an example of how to access the details of a reason object:EvaluationReason.C++ (client-side)
Expand C++ (client-side) code sample
Expand C++ (client-side) code sample
You can request and then programmatically inspect the reason for a particular feature flag evaluation.The To learn more, read
detail.Reason() response is described in Evaluation reasons.Here is an example:EvaluationDetail and BoolVariationDetail.Electron
Expand Electron code sample
Expand Electron code sample
The To learn more about the
variationDetail methods work the same as variation. They also provide additional “reason” information about how a flag value was calculated. For example, you can find out if the context was individually targeted for the flag or was matched by one of the flag’s rules. You can examine the “reason” data programmatically, or, if you capture detailed analytics events for flags, view it with Data Export.Here is an example:variationDetail methods, read LDEvaluationDetail and variationDetail. To learn more about the configuration option, read LDEvaluationReason.Flutter
Expand Flutter code sample
Expand Flutter code sample
The To learn more about the To learn more, read
variationDetail methods, such as boolVariationDetail, work the same as variation. They also provide additional “reason” information about how a flag value was calculated. For example, you can find out if the context was individually targeted for the flag or was matched by one of the flag’s rules. You can examine the “reason” data programmatically, or, if you capture detailed analytics events for flags, view it with Data Export.To enable this functionality, set the evaluationReasons configuration option to true when you initialize the client.Here is an example:variationDetail methods, read LDEvaluationDetail and boolVariationDetail. To learn more about the configuration option, read evaluationReasons.Here is an example of how to access the details of a reason object:LDEvaluationDetail.iOS
Expand iOS code sample
Expand iOS code sample
The To learn more about the
variationDetail methods, such as boolVariationDetail, work the same as the variation methods. They also provide additional “reason” information about how a flag value was calculated, such as if the user matched a specific rule. You can examine the “reason” data programmatically, or, if you capture detailed analytics events for flags, view it with Data Export.Here is an example:variationDetail methods, read LDEvaluationDetail and boolVariationDetail. To learn more about the configuration option, read LDConfig.Java
ScriptExpand JavaScript code sample
Expand JavaScript code sample
The To learn more about the
variationDetail method lets you evaluate a feature flag with the same parameters you would for variation. With variationDetail, you receive more information about how the value was calculated. In v4.x of the JavaScript SDK you can also use typed methods, for example, boolVariationDetail for boolean feature flags.The variation detail returns in an object containing both the result value and a “reason” object which tells you more information about the flag evaluation. For example, you can find out if the context was individually targeted for the flag or was matched by one of the flag’s rules. It also indicates if the flag returned the default value due to an error. You can examine the “reason” data programmatically, or, if you capture detailed analytics events for flags, view it with Data Export.Here is an example:*variationDetail methods, read LDEvaluationDetail. To learn more about the configuration option, read evaluationReasons.Node.js (client-side)
Expand Node.js (client-side) code sample
Expand Node.js (client-side) code sample
The To learn more about the
variationDetail method lets you evaluate a feature flag with the same parameters you would for variation. With variationDetail, you receive more information about how the value was calculated.The variation detail returns in an object that contains both the result value and a “reason” object which tells you more information about the flag evaluation. For example, you can find out if the user was individually targeted for the flag or was matched by one of the flag’s rules. It also indicates if the flag returned the default value due to an error. You can examine the “reason” data programmatically, or, if you capture detailed analytics events for flags, view it with Data Export.Here is an example:variationDetail method, read LDEvaluationDetail and variationDetail. To learn more about the configuration option, read evaluationReasons.React Native
Expand React Native code sample
Expand React Native code sample
The To learn more about the
variationDetail methods work the same way as the variation methods, and also provide additional information about how a flag value was calculated. For example, you can find out if the context was individually targeted for the flag or was matched by one of the flag’s rules. You can examine the “reason” data programmatically, or, if you capture detailed analytics events for flags, view it with Data Export. To view this reason information, set the withReasons configuration option to true.In React Native, there is a variation detail method for each type, such as boolVariationDetail or stringVariationDetail. In the React Native SDK version 10, there is also a hook for each type, such as useBoolVariationDetail or useStringVariationDetail.Here is an example:variationDetail methods, read LDEvaluationDetail, useBoolVariationDetail and boolVariationDetail.To learn more about the withReasons configuration option, read LDOptions.The SDK also includes an untyped method to determine the variation of a feature flag and provide information about how the flag value was calculated. To learn more, read variationDetail. We recommend using the strongly typed variation methods, such as boolVariationDetail, which perform type checks and handle type errors.Roku
Expand Roku code sample
Expand Roku code sample
For each variation type there is also an associated version that returns the reason a particular value was returned.Here is an example:These variation methods return an object containing the keys
value, reason, and variationIndex. The value field is the result of the evaluation. The reason field is an object that explains why the result happened, for example details about a rule match. The reason object will always contain a kind field. Lastly the variationIndex field contains the ID of the particular value returned. This field may be null.