Detect features
Check whether a feature is switched on in this app build before you show its UI.
Check one feature
Ask whether this build has a feature switched on. has is true only then — the right check before you show the UI.
Read the full map
Read every feature this build reports — enabled, available, and config per id — plus platform and the app version. Pass timeoutMs to wait that many milliseconds. get resolves null when the answer isn't known: a plain browser, an older app build, or a slow start. null is not off.
Don't treat null as off. Wait for bdk.ready() and call get again.
Interpret the states
enabled, available, and a null map are three different answers.
- Missing from
features, orenabledis nottrue— not in this build. Hide the UI. enabledistrueandavailableisfalse— in this build, but unusable on this device right now.get()returnednull— unknown. Don't treat it as off. Wait forbdk.ready()and try again.
When a feature is off
A call to a switched-off feature resolves ok: false with code: "common/feature_disabled". Branch on !result.ok. Each feature page names its id.
In a plain browser the call resolves ok: false with a code such as common/feature_disabled. Branch on !result.ok.