LaunchAnalytics class

Utility class for tracking launch analytics internally.

Launch counts and last-seen timestamps are kept in memory for the lifetime of the process. For persistent analytics, register an external sink via setExternalTracker (e.g., to forward events to Firebase, Amplitude, or your own backend).

Example — wiring Firebase Analytics:

LaunchAnalytics.setExternalTracker((type, uri) {
  FirebaseAnalytics.instance.logEvent(
    name: 'launchify_open',
    parameters: {'type': type.name, 'uri': uri.toString()},
  );
});

Properties

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

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

allLaunchCounts Map<LaunchType, int>
Returns a snapshot of all recorded launch counts keyed by LaunchType.
no setter

Static Methods

getLastLaunchTimestamp(LaunchType type) DateTime?
Retrieves the last launch timestamp for a given LaunchType.
getLaunchCount(LaunchType type) int
Retrieves the total launch count for a given LaunchType.
resetAnalytics([LaunchType? type]) → void
Resets analytics data for a specific LaunchType, or all types if type is omitted.
setExternalTracker(void tracker(LaunchType type, Uri uri)?) → void
Registers a global external analytics handler.
trackLaunch({required LaunchType type, required Uri uri, void onTrack(LaunchType type, Uri uri)?}) → void
Tracks a successful launch event.