trackInteraction method

Future<void> trackInteraction(
  1. String widgetId,
  2. InteractionType type, {
  3. dynamic value,
})

Track a user interaction

Implementation

Future<void> trackInteraction(
  String widgetId,
  InteractionType type, {
  dynamic value,
}) async {
  final event = InteractionEvent(
    widgetId: widgetId,
    type: type,
    value: value,
  );

  // Log to storage
  try {
    await _storage.logInteractionEvent(event);
  } catch (e) {
    if (kDebugMode) {
      print('Failed to log interaction: $e');
    }
  }

  // Notify listeners
  _notifyListeners(event);
}