bulkSendEvent method
Implementation
Future<void> bulkSendEvent(
List<Map<String, dynamic>> eventDetailsArray) async {
List<Map<String, dynamic>?> promiseArray =
eventDetailsArray.map((eventDetails) {
try {
Map<String, dynamic> response =
replaceKeys(eventDetails, _eventMapping, _eventRequiredCol);
return response;
} catch (error) {
print(error);
return null;
}
}).toList();
if (promiseArray.isNotEmpty) {
var map = new Map<String, dynamic>();
map["headers"] = '{"Authorization": "Bearer $_jwtToken"}';
map["data"] = jsonEncode(promiseArray);
// Send the request with the resolved data
_sendEventRequest("${baseUrl}/api/v1/user/event", map);
}
}