Mixpanel class Null safety

The primary class for integrating Mixpanel with your app.


Mixpanel(String token)


hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


addGroup(String groupKey, dynamic groupID) → void
Add a group to this user's membership for a particular group key [...]
alias(String alias, String distinctId) → void
The alias method creates an alias which Mixpanel will use to remap one id to another. Multiple aliases can point to the same identifier. [...]
clearSuperProperties() → void
Erase all currently registered superProperties. [...]
deleteGroup(String groupKey, dynamic groupID) → void
Permanently deletes this group's record from Group Analytics. [...]
eventElapsedTime(String eventName) Future<double?>
Retrieves the time elapsed for the named event since timeEvent() was called. [...]
flush() → void
Push all queued Mixpanel events and People Analytics changes to Mixpanel servers. [...]
getDistinctId() Future<String?>
Returns the current distinct id of the user. This is either the id automatically generated by the library or the id that has been passed by a call to identify(). [...]
getGroup(String groupKey, dynamic groupID) MixpanelGroup
Returns a MixpanelGroup object that can be used to set and increment Group Analytics properties. [...]
getPeople() People
Returns a Mixpanel People object that can be used to set and increment People Analytics properties. [...]
getSuperProperties() Future<Map?>
Returns a Map of the user's current super properties [...]
hasOptedOutTracking() Future<bool?>
Will return true if the user has opted out from tracking. return true if user has opted out from tracking. Defaults to false.
identify(String distinctId) → void
Associate all future calls to track() with the user identified by the given distinct id. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
optInTracking() → void
Use this method to opt-in an already opted-out user from tracking. People updates and track calls will be sent to Mixpanel after using this method. This method will internally track an opt-in event to your project.
optOutTracking() → void
Use this method to opt-out a user from tracking. Events and people updates that haven't been flushed yet will be deleted. Use flush() before calling this method if you want to send all the queues to Mixpanel before. [...]
registerSuperProperties(Map<String, dynamic> properties) → void
Register properties that will be sent with every subsequent call to track(). [...]
registerSuperPropertiesOnce(Map<String, dynamic> properties) → void
Register super properties for events, only if no other super property with the same names has already been registered. [...]
removeGroup(String groupKey, dynamic groupID) → void
Remove a group from this user's membership for a particular group key [...]
reset() → void
Clear super properties and generates a new random distinctId for this instance. Useful for clearing data when a user logs out.
setGroup(String groupKey, dynamic groupID) → void
Set the group this user belongs to. [...]
setLoggingEnabled(bool loggingEnabled) → void
This allows enabling or disabling of all Mixpanel logs at run time. All logging is disabled by default. Usually, this is only required if you are running into issues with the SDK that you want to debug [...]
setServerURL(String serverURL) → void
Set the base URL used for Mixpanel API requests. Useful if you need to proxy Mixpanel requests. Defaults to https://api.mixpanel.com. To route data to Mixpanel's EU servers, set to https://api-eu.mixpanel.com [...]
setUseIpAddressForGeolocation(bool useIpAddressForGeolocation) → void
This controls whether to automatically send the client IP Address as part of event tracking. With an IP address, geo-location is possible down to neighborhoods within a city, although the Mixpanel Dashboard will just show you city level location specificity. [...]
timeEvent(String eventName) → void
Begin timing of an event. Calling timeEvent("Thing") will not send an event, but when you eventually call track("Thing"), your tracked event will be sent with a "$duration" property, representing the number of seconds between your calls. [...]
toString() String
A string representation of this object. [...]
track(String eventName, {Map<String, dynamic>? properties}) → void
Track an event. [...]
trackWithGroups(String eventName, Map<String, dynamic> properties, Map<String, dynamic> groups) → void
Track an event with specific groups. [...]
unregisterSuperProperty(String propertyName) → void
Remove a single superProperty, so that it will not be sent with future calls to track(). [...]


operator ==(Object other) bool
The equality operator. [...]

Static Methods

init(String token, {bool optOutTrackingDefault = false, Map<String, dynamic>? superProperties}) Future<Mixpanel>
Initializes an instance of the API with the given project token. [...]