HMSAnalytics class


hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited


addDefaultEventParams(Map<String, Object>? params) Future<void>
Adds default event parameters.
clearCachedData() Future<void>
Delete all collected data in the local cache, including the cached data that fails to be sent.
deleteUserId() Future<void>
Deletes the created user ID.
deleteUserProfile(String key) Future<void>
Deletes the created user profile
disableLogger() Future<void>
Disables the HMSLogger capability.
enableLog() Future<void>
Enables the log function.
enableLogger() Future<void>
Enables the HMSLogger capability.
enableLogWithLevel(String logLevel) Future<void>
Enables the debug log function and sets the minimum log level.
getAAID() Future<String?>
Obtains the Anonymous Application ID (AAID).
getDataUploadSiteInfo() Future<String?>
Obtains the processing location of the uploaded data.
getReportPolicyThreshold(String policyType) Future<int?>
Obtains the threshold for event reporting.
getUserProfiles(bool predefined) Future<Map<String, dynamic>>
Enables AB Testing. Predefined or custom user attributes are supported.
isRestrictionEnabled() Future<bool>
Obtains the restriction status of Huawei Analytics.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
onEvent(String eventId, Map<String, dynamic> params) Future<void>
Records an event.
pageEnd(String pageName) Future<void>
Defines a custom page exit event.
pageStart(String pageName, String pageClassOverride) Future<void>
Defines a custom page entry event.
setAnalyticsEnabled(bool enabled) Future<void>
Specifies whether to enable event collection.
setChannel(String channel) Future<void>
Sets the app installation source.
setCollectAdsIdEnabled(bool enabled) Future<void>
Sets whether to collect advertising identifiers.
setCustomReferrer(String customReferrer) Future<void>
Sets a custom referrer.
setMinActivitySessions(int interval) Future<void>
Sets the minimum interval for starting a new session.
setPropertyCollection(String property, bool enabled) Future<void>
Sets whether to collect system attributes.
setPushToken(String token) Future<void>
Sets the push token.
setReportPolicies({int? scheduledTime, bool? appLaunch, bool? moveBackground, int? cacheThreshold}) Future<void>
Sets data reporting policies.
setRestrictionEnabled(bool enabled) Future<void>
Specifies whether to enable restriction of Huawei Analytics.
setSessionDuration(int duration) Future<void>
Sets the session timeout interval.
setUserId(String? userId) Future<void>
Set a user ID.
setUserProfile(String key, String value) Future<void>
User attribute values remain unchanged throughout the app's lifecycle and session. A maximum of 25 user attribute names are supported. If an attribute name is duplicate with an existing one, the attribute names needs to be changed.
toString() String
A string representation of this object.


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

Static Methods

getInstance({String routePolicy = ''}) Future<HMSAnalytics>
The options are CN (China), DE (Germany), SG (Singapore), and RU (Russia).