sendEventRequest function
Implementation
Future<http.Response> sendEventRequest(
List<EventRequest> eventRequest,
String token,
) async {
Debug.print("EventRequest: ${jsonEncode(eventRequest)}");
final List<Map<String, dynamic>> eventRequestJsonList =
eventRequest.map((request) => request.toJson()).toList();
final uniqueId = await PerceptFlutterPlatform.instance.getUniqueID();
final headers = authHeaders(token, uniqueId);
final body = jsonEncode({'events': eventRequestJsonList});
final response = await http.post(
Uri.parse(sendEventUrl),
headers: headers,
body: body,
);
Debug.print("EventRequest Response: ${response.body}");
return response;
}