post method

Future<CoapResponse> post(
  1. String path, {
  2. required String payload,
  3. CoapMediaType? format,
  4. CoapMediaType? accept,
  5. bool confirmable = true,
  6. List<CoapOption>? options,
  7. bool earlyBlock2Negotiation = false,
  8. int maxRetransmit = 0,
  9. CoapMulticastResponseHandler? onMulticastResponse,
})

Sends a POST request.

Implementation

Future<CoapResponse> post(
  final String path, {
  required final String payload,
  final CoapMediaType? format,
  final CoapMediaType? accept,
  final bool confirmable = true,
  final List<CoapOption>? options,
  final bool earlyBlock2Negotiation = false,
  final int maxRetransmit = 0,
  final CoapMulticastResponseHandler? onMulticastResponse,
}) {
  final request = CoapRequest.newPost(confirmable: confirmable)
    ..setPayloadMedia(payload, format);
  _build(
    request,
    path,
    accept,
    options,
    earlyBlock2Negotiation,
    maxRetransmit,
  );
  return send(request, onMulticastResponse: onMulticastResponse);
}