sendEvent static method

Future<bool> sendEvent({
  1. required String eventName,
  2. required String appToken,
  3. String? identifier,
  4. String? registration,
  5. Map<String, dynamic> eventValues = const {},
  6. bool conversionEvent = false,
  7. double conversionValue = 0,
  8. String conversionNotId = '',
})

Implementation

static Future<bool> sendEvent({
  required String eventName,
  required String appToken,
  String? identifier,
  String? registration,
  Map<String, dynamic> eventValues = const {},
  bool conversionEvent = false,
  double conversionValue = 0,
  String conversionNotId = '',
}) async {
  if (identifier == null && registration == null) {
    throw InngageException(
      'Unfortunately it was not possible send an event,'
      ' you need to declare the identifier or registration',
    );
  }
  try {
    await Future.microtask(
      () async => await _inngageNetwork.sendEvent(
        eventName: eventName,
        appToken: appToken,
        identifier: identifier ?? '',
        registration: registration ?? '',
        eventValues: eventValues,
        conversionValue: conversionValue,
        conversionNotId: conversionNotId,
        conversionEvent: conversionEvent,
      ),
    );
  } catch (e) {
    return false;
  }
  return true;
}