btx 0.0.2 copy "btx: ^0.0.2" to clipboard
btx: ^0.0.2 copied to clipboard

BTX Flutter SDK for customer app telemetry, feature flags, messaging, and native integrations.

BTX Flutter SDK #

btx is the BTX Flutter SDK for customer-app telemetry, feature flags, messaging, and native integrations.

Install #

dependencies:
  btx: ^0.0.1

Quickstart #

import 'package:btx/btx.dart';

await Btx.configure(
  BtxConfiguration(
    publishableClientKey: 'cfk_...',
    appContext: await BtxAppContext.current(),
  ),
);

await Btx.identify(
  const BtxCustomer(
    externalId: 'customer_123',
    name: 'Taylor',
    email: 'taylor@example.com',
  ),
);

Btx.log(
  'checkout_started',
  level: BtxLogLevel.info,
  message: 'Customer started checkout.',
  properties: <String, Object?>{'cartId': 'cart_123'},
);

Btx.messenger.present();

Mount BtxHost inside your MaterialApp so the SDK can present messenger UI and foreground notification surfaces:

MaterialApp(
  home: BtxHost(
    child: MyAppHome(),
  ),
);

Facade Surface #

  • Btx.configure(BtxConfiguration) configures the SDK once.
  • Btx.identify(BtxCustomer?) binds or clears the active customer.
  • Btx.log(...) and Btx.logInput(...) enqueue host telemetry.
  • Btx.enqueueLog(...) appends a log from a background isolate after bootstrap.
  • Btx.refreshFeatureFlags() refreshes the active customer flag snapshot.
  • Btx.isFeatureEnabled(...) reads the current flag snapshot synchronously.
  • Btx.messenger.present(...), presentThread(...), presentCompose(...), and dismiss() own messenger presentation.
  • Btx.flush() and Btx.dispose() support teardown and test cleanup.

Configuration #

await Btx.configure(
  BtxConfiguration(
    apiBaseUrl: Uri.parse('http://localhost:3000'),
    projectId: 'project_123',
    publishableClientKey: 'cfk_...',
    appContext: const BtxAppContext(
      appVersion: '1.0.0',
      buildNumber: '42',
      attributes: <String, String>{
        'bundleId': 'com.example.app',
      },
    ),
    features: const <BtxFeature>{
      BtxFeature.logs,
      BtxFeature.messenger,
    },
  ),
);

Use features: {BtxFeature.logs} for telemetry-only integrations such as the current Captify use case.

Android #

Android messenger UI is in scope for the Flutter SDK. Android push is explicitly unsupported until a real FCM implementation is added; the SDK reports that unsupported state instead of silently no-oping.

Advanced Surfaces #

The package still exposes lower-level controller/runtime types for tests, custom embedded views, and advanced host ownership. New app integrations should prefer the Btx facade first. See doc/advanced.md for worker-mode telemetry, direct controller ownership, and native push details.

0
likes
0
points
573
downloads

Publisher

unverified uploader

Weekly Downloads

BTX Flutter SDK for customer app telemetry, feature flags, messaging, and native integrations.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, http, image, image_picker, package_info_plus, path, path_provider, shared_preferences, uuid

More

Packages that depend on btx

Packages that implement btx