postWithTimeout method

Future<Response> postWithTimeout(
  1. Map<String, dynamic> bodyMap
)

Implementation

Future<Response> postWithTimeout(Map<String, dynamic> bodyMap) {
  return this
      .post(fromUriOrString(this.endpoint), body: json.encode(bodyMap))
      .timeout(
    const Duration(seconds: kRequestTimeoutSeconds),
    onTimeout: () {
      return Response(
        json.encode(kTimeoutResponsePayload),
        408,
        headers: this.requestHeaders,
      );
    },
  );
}