trackNotificationClick static method

Future<void> trackNotificationClick({
  1. required String notificationId,
  2. required String title,
  3. required String body,
  4. String? email,
})

Track notification click event

This method should be called when the app is opened from a notification notificationId The notification ID (from server or auto-generated) title The notification title body The notification body email The user's email address

Implementation

static Future<void> trackNotificationClick({
  required String notificationId,
  required String title,
  required String body,
  String? email,
}) async {
  _checkInitialization();

  try {
    await _channel.invokeMethod('trackNotificationClick', {
      'notificationId': notificationId,
      'title': title,
      'body': body,
      'email': email,
    });
    _log('Notification click tracked: $notificationId',
        GoMailerLogLevel.debug);
  } catch (e) {
    _log('Failed to track notification click: $e', GoMailerLogLevel.error);
    throw GoMailerException('Failed to track notification click: $e');
  }
}