sendEventRequest function

Future<Response> sendEventRequest(
  1. List<EventRequest> eventRequest,
  2. String token
)

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 response = await http.post(
    Uri.parse(sendEventUrl),
    headers: await getAuthHeaders(token),
    body: jsonEncode({'events': eventRequestJsonList}),
  );
  Debug.print("EventRequest Response: ${response.body}");
  return response;
}