Official Flutter Tracking Library for Mixpanel Analytics
/// Set the number of events sent in a single network request to the Mixpanel server.
/// By configuring this value, you can optimize network usage and manage the frequency of communication between the client
/// and the server. The maximum size is 50; any value over 50 will default to 50.
/// * [flushBatchSize] an int representing the number of events sent in a single network request.
void setFlushBatchSize(int flushBatchSize) {
_channel.invokeMethod<void>('setFlushBatchSize',
<String, dynamic>{'flushBatchSize': flushBatchSize});
}
4.2.0
This major release removes all remaining calls to Mixpanel's /decide
API endpoint. The main effect of this is that the SDK no longer fetches the remote status of your project's "Automatically collect common mobile events" setting. From this version forward, automatic event tracking can only be controlled by the, now required, parameter trackAutomaticEvents
. Upon upgrading, existing implementations will need to add this parameter to their Mixpanel initializer calls.
import 'package:mixpanel_flutter/mixpanel_flutter.dart';
class MixpanelManager {
static Mixpanel? _instance;
static Future<Mixpanel> init() async {
if (_instance == null) {
_instance = await Mixpanel.init("YOUR_PROJECT_TOKEN", trackAutomaticEvents: true);
}
return _instance!;
}
}