sendEvent method
Future<void>
sendEvent({
- required String eventName,
- required String appToken,
- required String identifier,
- required String registration,
- Map<
String, dynamic> eventValues = const {}, - bool conversionEvent = false,
- double conversionValue = 0,
- String conversionNotId = '',
override
Implementation
@override
Future<void> sendEvent({
required String eventName,
required String appToken,
required String identifier,
required String registration,
Map<String, dynamic> eventValues = const {},
bool conversionEvent = false,
double conversionValue = 0,
String conversionNotId = '',
}) async {
final eventRequest = NewEventRequest(
appToken: appToken,
identifier: identifier,
registration: registration,
eventName: eventName,
eventValues: eventValues,
conversionEvent: conversionEvent,
conversionNotId: conversionNotId,
conversionValue: conversionValue,
);
final event = Event(newEventRequest: eventRequest);
final payload = eventToJson(event);
final resp = await http.post(
Uri.parse(AppConstants.baseUrl + '/events/newEvent/'),
headers: {
'Content-Type': 'application/json; charset=UTF-8',
if (keyAuthorization.isNotEmpty)
'Authorization': 'key=$keyAuthorization'
},
body: payload,
);
if (InngageProperties.getDebugMode()) {
logger.i(resp.request);
logger.i(payload);
logger.i(resp.body);
}
if (resp.statusCode != 200) {
debugPrint(
'Unfortunately it was not possible send an event',
);
}
}