Skip to main content

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

Pure Dart RudderStack server-side SDK: identify, track, page, screen, group and alias, sent in gzip batches with retries. Runs on Dart servers, CLIs and Flutter apps.

example/rudderstack_api_example.dart

import 'dart:io';

import 'package:rudderstack_api/rudderstack_api.dart';

Future<void> main() async {
  final analytics = RudderAnalytics(
    Platform.environment['RUDDERSTACK_WRITE_KEY']!,
    dataPlaneUrl:
        Uri.parse(Platform.environment['RUDDERSTACK_DATA_PLANE_URL']!),
  );

  final delivered = [
    analytics.identify(
      userId: 'user-42',
      traits: {'email': 'jane@example.com', 'plan': 'pro'},
    ),
    analytics.track(
      userId: 'user-42',
      event: 'Order Completed',
      properties: {'revenue': 49.9, 'currency': 'EUR'},
    ),
  ];

  try {
    await analytics.flush(delivered);
  } on RudderStackException catch (error) {
    stderr.writeln('Delivery failed: $error');
  } finally {
    await analytics.shutdown();
  }
}
0
likes
160
points
26
downloads

Documentation

API reference

Publisher

verified publisherfullphysio.com

Weekly Downloads

Pure Dart RudderStack server-side SDK: identify, track, page, screen, group and alias, sent in gzip batches with retries. Runs on Dart servers, CLIs and Flutter apps.

Repository (GitHub)
View/report issues
Contributing

Topics

#rudderstack #analytics #tracking #server

License

MIT (license)

Dependencies

http

More

Packages that depend on rudderstack_api