recordEvent method
Implementation
Future<void> recordEvent(
Offset position,
BuildContext context,
bool debugMode,
double scrooll,
String path,
Map<String, String>? properties,
String? session,
) async {
if (isInvalidToken(token)) return;
try {
final sizes = getUtilScreenSize(context);
final double screenWidth = sizes[0];
final double screenHeight = sizes[1];
final List<double> pos = positionFromEvent(position, context);
final Map<String, dynamic> eventBody = {
"x": pos[0],
"y": pos[1],
"scroll": scrooll,
"path": path,
"screenWidth": screenWidth,
"screenHeight": screenHeight,
"os": getOS(),
if (properties != null) 'props': properties,
};
final instance = HeatlensInstance();
final String userSession = session ?? await instance.session();
if (debugMode) debugPrint(jsonEncode(eventBody));
await _post(body: {...eventBody, 'session': userSession});
} catch (_) {
return;
}
}