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.
Overview
This topic explains how the all flags feature works in the LaunchDarkly SDKs that support it. The all flags feature is available for client-side, server-side, and edge SDKs.About the all flags feature
The all flags feature returns an object containing the variation values of all the feature flags targeted to a specific context object or user object. Server-side SDKs also return metadata for use on the front end, including information on flag keys, variations, and prerequisites. You can use this metadata to provide bootstrap flag settings for LaunchDarkly’s JavaScript-based SDKs. To learn more, read the JavaScript SDK reference. You can find the expected flag values for a specific context on its details page:
allFlags method does not send analytics events to LaunchDarkly by default for most SDKs. The exceptions to this are Electron, Node.js (client-side), Vue, and older versions of the JavaScript SDKs, which do send analytics events by default. For these SDKs, you can disable sending analytics events when calling the all flags method if needed. To learn more about what analytics events do in LaunchDarkly, read Analytics events.
For client-side SDKs, the all flags feature may return a null value in cases where a flag’s fallback value would be served to the end user.
For server-side SDKs, you can use the all flags feature to pass feature flags to your front end. In particular, you can use it to provide bootstrap flag settings for the JavaScript SDK. To learn more about bootstrapping from a client-side SDK, read Bootstrapping.
Details about each SDK’s configuration are available in the SDK-specific sections below:
Client-side SDKs
Before you implement this feature, read About the all flags feature. 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
- React Web
- Roku
.NET (client-side)
Expand .NET (client-side) code sample
Expand .NET (client-side) code sample
AllFlags method produces a map of feature flag keys to their values for a context object:Android
Expand Android code sample
Expand Android code sample
allFlags method produces a map of feature flag keys to their values for a context object:C++ (client-side)
Expand C++ (client-side) code sample
Expand C++ (client-side) code sample
AllFlags method produces a map of feature flag keys to their values for a context object:AllFlags in the LDClient documentation.Electron
Expand Electron code sample
Expand Electron code sample
allFlags() method produces a map of feature flag keys to their values for a user object. The map contains null values for any flags that would return the fallback value. The fallback value is the second argument that you normally pass to variation.Unlike most of our SDKs, our Electron SDK’s allFlags() method sends analytics events to LaunchDarkly. If you do not want allFlags() to generate any analytics events, you can turn this off by setting the configuration option sendEventsOnlyForVariation to true.To use the all flags feature:Flutter
Expand Flutter code sample
Expand Flutter code sample
allFlags method produces a map of feature flag keys to their values for a context object:allFlags.iOS
Expand iOS code sample
Expand iOS code sample
LDClient is not started, it returns nil.To use the all flags feature:Java
ScriptExpand JavaScript code sample
Expand JavaScript code sample
allFlags() method produces a map of feature flag keys to their values for a context object.The map contains null values for any flags that would return the fallback value. The fallback value is the second argument that you normally pass to variation.In the JavaScript SDK v3.x and earlier, the allFlags method sends analytics events to LaunchDarkly. You can turn this off by setting the configuration option sendEventsOnlyForVariation to true.In the JavaScript SDK v4.x, the allFlags method no longer sends analytics events to LaunchDarkly.To use the all flags feature:allFlags.Node.js (client-side)
Expand Node.js (client-side) code sample
Expand Node.js (client-side) code sample
allFlags method produces a map of feature flag keys to their values for a context object.The map contains null values for any flags that would return the fallback value. The fallback value is the second argument that you normally pass to variation.Unlike most of our SDKs, our Node.js (client-side) SDK’s allFlags method sends analytics events to LaunchDarkly. If you do not want allFlags to generate any analytics events, you can turn this off by setting the sendEventsOnlyForVariation option to true.To use the all flags feature:React Web
Expand React Web code sample
Expand React Web code sample
allFlags() method produces a map of feature flag keys to their values for a context object.Here is an example:allFlags functionality. However, unlike JavaScript, the React Web SDK does not send analytics events for allFlags by default. It only sends analytics events for variation or useFlags calls. This behavior matches the behavior of most of our other SDKs, besides the JavaScript SDK.If you do need to generate analytics events for the allFlags method, you can set the sendEventsOnlyForVariation configuration option to false. We do not recommend this, because then you will receive events for all flags. You will have no way to differentiate events for flags that are in use from events for flags that are not in use.Analytics events include feature events, debug events, and evaluation events. To learn more, read About the all flags feature, above.React Native
Expand React Native code sample
Expand React Native code sample
allFlags method returns a map of feature flag keys to their values for a context, or an empty object if flags cannot be evaluated.To use the all flags feature:allFlags.Roku
Expand Roku code sample
Expand Roku code sample
Server-side SDKs
Before you implement this feature, read About the all flags feature. This feature is available in the following server-side SDKs:- .NET (server-side)
- Apex
- C++ (server-side)
- Erlang
- Go
- Haskell
- Java
- Lua
- Node.js (server-side)
- PHP
- Python
- Ruby
- Rust
.NET (server-side)
Expand .NET (server-side) code sample
Expand .NET (server-side) code sample
AllFlagsState method produces a map of feature flag keys to their values and other metadata for a specific context object.To use the all flags feature:Apex
Expand Apex code sample
Expand Apex code sample
allFlags method produces a map of feature flag keys to their values for a specific user object:C++ (server-side)
Expand C++ (server-side) code sample
Expand C++ (server-side) code sample
AllFlagsState method produces a map of feature flag keys to their values and other metadata for a specific context. Here’s how to call it and output the result:Erlang
Expand Erlang code sample
Expand Erlang code sample
all_flags_state method produces a map of feature flag keys to their values and other metadata for a specific context object.To use the all flags feature:Go
Expand Go code sample
Expand Go code sample
AllFlagsState method produces a map of feature flag keys to their values and other metadata for a specific context object.This example specifies the extra ClientSideOnly option so that only the feature flags designated for client-side use are included in the result.To use the all flags feature:Haskell
Expand Haskell code sample
Expand Haskell code sample
allFlags method produces a map of feature flag keys to their values and other metadata for a specific context object.To use the all flags feature:Java
Expand Java code sample
Expand Java code sample
allFlagsState method produces a map of feature flag keys to their values and other metadata for a specific context object:allFlagsState.Lua
Expand Lua code sample
Expand Lua code sample
allFlags method produces a map of feature flag keys to their values and other metadata for a specific context.Here’s how to call it and output the result:allFlags]](https://launchdarkly.github.io/lua-server-sdk/modules/launchdarkly-server-sdk.html#allFlags).Node.js (server-side)
Expand Node.js (server-side) code sample
Expand Node.js (server-side) code sample
allFlagsState method produces a map of feature flag keys to their values and other metadata for a specific context object.To use the all flags feature:PHP
Expand PHP code sample
Expand PHP code sample
allFlagsState method produces a map of feature flag keys to their values and other metadata for a specific context object:Python
Expand Python code sample
Expand Python code sample
all_flags_state method produces a map of feature flag keys to their values and other metadata for a specific context object:Ruby
Expand Ruby code sample
Expand Ruby code sample
all_flags_state method produces a map of feature flag keys to their values and other metadata for a specific context object:Rust
Expand Rust code sample
Expand Rust code sample
all_flags_detail method produces a map of feature flag keys to their values and other metadata for a specific context object:Edge SDKs
Before you implement this feature, read About the all flags feature. This feature is available for the following edge SDKs:Akamai
Expand Akamai code sample
Expand Akamai code sample
allFlagsState method produces an object that encapsulates the state of all feature flags for a given context. This method does not send analytics events back to LaunchDarkly.To use the all flags feature:allFlagsState, the SDK fetches the flag data from the EdgeKV store. Your Akamai resource tier may limit how many of these queries you can make while a single worker handler is being executed. Using the Akamai SDK cache can help alleviate this limit. To learn more, read Understand resource limits and caching options.Cloudflare
Expand Cloudflare code sample
Expand Cloudflare code sample
allFlagsState method produces a map of feature flag keys to their values and other metadata for a specific context object.To use the all flags feature:allFlagsState method does not generate events in edge SDKs. Use the variation method instead. To learn more, read Evaluating flags.Fastly
Expand Fastly code sample
Expand Fastly code sample
allFlagsState method produces a map of feature flag keys to their values and other metadata for a specific context object.To use the all flags feature:allFlagsState.allFlagsState method does not generate events in edge SDKs. Use the variation method instead. To learn more, read Evaluating flags.Vercel
Expand Vercel code sample
Expand Vercel code sample
allFlagsState method produces a map of feature flag keys to their values and other metadata for a specific context object.To use the all flags feature:allFlagsState.allFlagsState method does not generate events in edge SDKs. Use the variation method instead. To learn more, read Evaluating flags.