post function

Future<Response> post(
  1. String endpoint,
  2. String accessToken,
  3. Map<String, dynamic> jsonData
)

Implementation

Future<http.Response> post(
  String endpoint,
  String accessToken,
  Map<String, dynamic> jsonData,
) {
  Uri url = Uri.parse("$apiUrl$endpoint");

  Map<String, String> headers = {
    'Content-Type': 'application/json',
    'Authorization': "Bearer $accessToken",
  };

  return http.post(
    url,
    headers: headers,
    body: jsonEncode(jsonData),
  );
}