Analytics class
An analytics class that notifies and monitors information related to events within the app, user tracking, and more, to external services or within the app itself.
Constructors
Properties
-
events
→ Stream<
AnalyticsEvent> -
The stream of AnalyticsEvent that are sent via event, rawEvent, and other method that send events.
no setter
- globalContext → AnalyticsContext
-
Analytics Context found in the route.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
interactionContextData
→ Map<
String, Object?> ? -
A Map of data from the Context of a Widget with the most recently interacted (touched) with Analytics information by the user.
no setter
-
A Map of data to retain analytics information for page transitions.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
event(
{required String name, Map< String, Object?> ? data, BuildContext? context, Level logLevel = Level.INFO}) → void -
Send analytics for the event with the name
name
. When you cannot use Patapata's standard Analytics-related Widget or when you want to manually send events, you can follow this approach. -
eventsFor<
T> () → Stream< AnalyticsEvent> -
Listen to analytics events.
These will be filtered by checking
T
in the App.environment if it's a AnalyticsEventFilterEnvironment to see if a given event should be sent to that typeT
. -
getGlobalContext(
Object key) → AnalyticsContext? -
The AnalyticsContext that was set with
key
in the global context. -
getRouteContext(
Object key) → AnalyticsContext? -
The AnalyticsContext that was set with
key
in the global route context. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
rawEvent(
AnalyticsEvent event, {Level logLevel = Level.INFO}) → void -
Send analytics for the information in
event
. Used when you want to send custom analytics events. -
revenueEvent(
{required double revenue, String? currency, String? orderId, String? receipt, String? productId, String? productName, String? eventName, Map< String, Object?> ? data, AnalyticsContext? context, Level logLevel = Level.INFO}) → void - Send analytics for revenue. 'Revenue' refers to numeric values related to sales or earnings.
-
routeViewEvent(
Route route, { }) → void -
Send analytics for the
route
. Used when you want to send events related to page transitions. -
setGlobalContext(
Object key, AnalyticsContext? context) → void -
Adds an AnalyticsContext with the
key
name to the global context. Passing null forcontext
will remove it from the global context. -
setRouteContext(
Object key, AnalyticsContext? context) → void -
Add an AnalyticsContext with the
key
name to the global route context. If you pass null for the argumentcontext
of this function, it will be removed from the global route context. The values set in this Route Context will disappear when transitioning to other pages. example: -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
defaultMakeLoggableToNative(
Object? object) → Object -
Convert the data type of
object
to int, double, or String using the default judgment and return it. Additionally, in this function, data for the Analytics system trims the value side of key-value pairs to a maximum of 100 characters. This is because the average length limitation for the value strings of third-party Analytics systems is around 100 characters. -
tryConvertToLoggableJsonParameters(
String prefix, Object? object) → Map< String, Object> -
Convert
object
into a loggable JSON parameter with the prefixprefix
.