Flutter SDK
Configure BTX for Flutter
Configure the SDK once, select only the capabilities your app needs, and resolve platform-specific publishable keys.
Configure once
Call Btx.configure(...) during app startup before identifying a customer or
using another BTX capability.
await Btx.configure(
BtxConfiguration(
publishableClientKey: 'cfk_...',
),
);Choose enabled features
The default feature set is logs plus customer messages. Pass an explicit set for telemetry-only apps or to opt in to the knowledge base.
await Btx.configure(
BtxConfiguration(
publishableClientKey: 'cfk_...',
features: const <BtxFeature>{
BtxFeature.logs,
BtxFeature.messenger,
BtxFeature.knowledgeBase,
},
),
);BtxFeature.logsselects a telemetry-only integration; customer-targeted feature flags use the same telemetry session.BtxFeature.messengerenables the packaged messenger, foreground updates, and push registration.BtxFeature.knowledgeBaseopts in to help content and also requiresBtxFeature.messenger.
Resolve platform and variant keys
Apps with multiple mobile targets can provide one key set. BTX chooses the key that matches the current iOS bundle ID or Android package name and uses the default key when no explicit mapping matches.
await Btx.configure(
BtxConfiguration.withPublishableClientKeys(
publishableClientKeys: const BtxPublishableClientKeys(
defaultKey: 'cfk_ios_prod',
iosBundleIds: <String, String>{
'com.example.app.beta': 'cfk_ios_beta',
},
androidPackageNames: <String, String>{
'com.example.app': 'cfk_android',
},
),
features: const <BtxFeature>{BtxFeature.logs},
),
);Attach app context
BTX derives app version, build number, platform, bundle ID or package name, OS,
device family or model, physical-device state, and SDK version automatically.
Use BtxAppContext only for explicit version overrides or app-specific,
low-cardinality attributes.
await Btx.configure(
BtxConfiguration(
publishableClientKey: 'cfk_...',
appContext: const BtxAppContext(
attributes: <String, String>{
'releaseRing': 'beta',
},
),
),
);The SDK ignores host attempts to replace its platform, OS, device, and SDK metadata keys. It does not collect advertising identifiers, persistent phone identifiers, serial numbers, user-assigned device names, storage readings, or memory readings.
Choose one presentation host
Use BtxHost for the normal widget-tree integration. If the app already owns a
root navigator key, provide it to BtxConfiguration and BTX will attach its
messenger and knowledge base overlays there.
final navigatorKey = GlobalKey<NavigatorState>();
await Btx.configure(
BtxConfiguration(
publishableClientKey: 'cfk_...',
navigatorKey: navigatorKey,
),
);
MaterialApp(
navigatorKey: navigatorKey,
home: const MyAppHome(),
)