AnalyticsService class

Singleton analytics service.

Usage:

await AnalyticsService.init();
AnalyticsService.instance.logEvent(AnalyticsEvents.viewCreated,
    parameters: {'view_type': 'form', 'model': 'res.partner'});

Properties

hashCode → int
The hash code for this object.
no setterinherited
isEnabled → bool
Whether analytics collection is active.
no setter
localEvents → List<AnalyticsEvent>
Returns a read-only list of locally recorded events.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

clearLocalEvents() → void
Clears the local in-memory event log.
logEvent(String name, {Map<String, Object>? parameters}) → Future<void>
Log a named analytics event with optional parameters.
logExport(String method, String viewType) → Future<void>
logFieldAdded(String fieldType) → Future<void>
logTemplateApplied(String templateId) → Future<void>
logValidationError(String context, int errorCount) → Future<void>
logViewCreated(String viewType, String model) → Future<void>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setEnabled(bool value) → void
Enable or disable analytics globally (respects user consent).
setUserId(String? userId) → Future<void>
Set the analytics user ID (call after login, clear on logout).
setUserProperty({required String name, required String? value}) → Future<void>
Set a persistent user property (e.g. subscription tier).
toString() → String
A string representation of this object.
inherited

Operators

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

Static Properties

instance → AnalyticsService
Initialized singleton.
no setter

Static Methods

init({bool useFirebase = false}) → Future<void>
Initialize the service.