Heap class

A singleton class exposing the Heap SDK.

{@tool snippet}

The SDK is initialized by calling startRecording with your environment ID. After that, you can call track, identify and other API methods to record and enrich events.

import 'package:heap_flutter_bridge/heap_flutter_bridge.dart';

Heap().startRecording('YOUR_APP_ID');
Heap().track('my event');

{@end-tool}

Note: All methods in this class return a future which resolves when the underlying system completes. These futures do not need to be waited on before continuing, as Heap will execute the events in the order received.

Constructors

Heap()
factory

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

addEventProperties(Map<String, dynamic> properties) Future<void>
Adds properties to future events from this device.
addUserProperties(Map<String, dynamic> properties) Future<void>
Adds properties to the current user.
clearEventProperties() Future<void>
Clears all event properties.
fetchSessionId() Future<String?>
Returns the current session ID, creating a new session expired.
getIdentity() Future<String?>
Returns the current identity that was set with identify.
getSessionId() Future<String?>
Returns the current session ID if the session has not expired.
getUserId() Future<String?>
Returns the current Heap-generated user ID.
identify(String identity) Future<void>
Assigns an identity to the current user ID.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeEventProperty(String name) Future<void>
Removes a previously added event property.
resetIdentity() Future<void>
Clears an identity previously set with identify.
setLogLevel(HeapLogLevel logLevel) Future<void>
Sets the log level.
startRecording(String environmentId, [Map<String, dynamic>? options]) Future<void>
Initializes the Heap SDK and enables Heap to start recording data.
stopRecording() Future<void>
Shuts down the Heap SDK and prevents any further data collection.
toString() String
A string representation of this object.
inherited
track(String event, [Map<String, dynamic>? properties, DateTime? timestamp, HeapSourceInfo? sourceInfo]) Future<void>
Records an event.

Operators

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