Skip to main content

posthog_api 0.1.0 copy "posthog_api: ^0.1.0" to clipboard
posthog_api: ^0.1.0 copied to clipboard

Pure Dart server-side client for PostHog: event capture, identify, alias, groups, batching with retries, and remote feature flags. A port of posthog-node.

example/posthog_api_example.dart

import 'package:posthog_api/posthog_api.dart';

Future<void> main() async {
  final posthog = PostHog(
    'phc_your_project_api_key',
    host: Uri.parse('https://eu.i.posthog.com'),
  );

  posthog.capture(
    distinctId: 'user-123',
    event: 'program_created',
    properties: {
      'exercises': 6,
      r'$set': {'plan': 'pro'},
    },
  );

  posthog.identify(
    distinctId: 'user-123',
    properties: {'email': 'ada@example.com'},
  );

  if (await posthog.isFeatureEnabled('new-editor', 'user-123') ?? false) {
    print('new-editor is on');
  }

  await posthog.shutdown();
}
0
likes
160
points
78
downloads

Documentation

API reference

Publisher

verified publisherfullphysio.com

Weekly Downloads

Pure Dart server-side client for PostHog: event capture, identify, alias, groups, batching with retries, and remote feature flags. A port of posthog-node.

Repository (GitHub)
View/report issues
Contributing

Topics

#posthog #analytics #feature-flags #server

License

MIT (license)

Dependencies

http

More

Packages that depend on posthog_api