postAsync<TReceive> method

Future<TerraRestfulResponse> postAsync<TReceive>(
  1. String endpoint,
  2. String data
)

Runs a POST operation via HttpClient to send information.

Implementation

Future<TerraRestfulResponse> postAsync<TReceive>(
    String endpoint, String data) async {
  var response = await clientService.postAsync(endpoint, data);
  if (response.statusCode != 200) {
    throw Exception(
        "Status Code: ${response.statusCode}, Reason: ${response.reasonPhrase}");
  }

  return await deserializeResponse(response);
}