AnalyticsProvider class abstract

Abstract base for analytics providers.

Implement this to add custom analytics services.

class MyAnalytics extends AnalyticsProvider {
  @override
  String get name => 'my_analytics';

  @override
  void initialize() { /* setup */ }

  @override
  void trackPageView({required String path, String? title, Map<String, dynamic>? parameters}) {
    // send page view
  }

  @override
  void trackEvent({required String name, Map<String, dynamic>? parameters}) {
    // send event
  }

  @override
  void dispose() { /* cleanup */ }
}
Implementers

Constructors

AnalyticsProvider()

Properties

hashCode int
The hash code for this object.
no setterinherited
name String
Human-readable name of this provider
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → void
Cleanup resources
initialize() → void
Initialize the provider (inject scripts, etc.)
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setUserProperties(Map<String, dynamic> properties) → void
Set user properties
toString() String
A string representation of this object.
inherited
trackEvent({required String name, Map<String, dynamic>? parameters}) → void
Track a custom event
trackPageView({required String path, String? title, Map<String, dynamic>? parameters}) → void
Track a page view

Operators

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