Flutter
Add the capreolus pub package and start the SDK from main().
Install
bash
flutter pub add capreolusThat writes capreolus: ^0.1.0 into your pubspec.yaml and runs pub get.
Initialize
Call Capreolus.start at the top of main(), before runApp:
main.dart
import 'package:capreolus/capreolus.dart';
import 'package:flutter/material.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Capreolus.start(
apiKey: 'pub_xxx',
apiUrl: 'https://api.capreolus.app',
);
runApp(const AcmeApp());
}Public API
| Symbol | Purpose |
|---|---|
Capreolus.start(apiKey:, apiUrl:) | Bootstraps the SDK on iOS and Android. |
Capreolus.identify(userId, traits:) | Associate the current session with a user. |
Capreolus.track(event, properties:) | Emit a custom event. |
Capreolus.flush() | Force-send queued events. |
The plugin supports Dart 3.0+ and the new federated plugin layout. Linux, macOS, and Windows targets are no-ops — events are buffered until the app reaches a supported platform.