http library

A ready-made AckHttpSender over package:http.

OPT IN BY IMPORTING THIS, and the separate entry point is the point. The core library stays free of an HTTP client so its logic can be tested without a network, and so this package never chooses an app's client for it -- some of the fleet is on dio. An app that does not import ackbiz_billing/http.dart pulls none of this into its bundle.

import 'package:ackbiz_billing/http.dart';

final api = AckBizApi(..., sender: AckHttpClientSender());

WHY THIS EXISTS AT ALL, given the seam is nine lines to implement: the seam carries a rule that is easy to get wrong and expensive when it is, and a rule living only in a doc comment is a rule each adopter re-reads and one of them misreads.

Return normally for every status code, 500 included. Throw only when no response arrived -- a timeout, a reset, DNS.

A 4xx is the server having considered the request and refused. A throw is "we do not know what happened", and for a call that creates an order those are opposite instructions: refuse means show the message, unknown means reconcile with the same idempotency key. Collapsing them is how one customer gets charged twice.

Classes

AckHttpClientSender
AckHttpSender over package:http.
AckHttpSender
Sends a request and returns what came back.
AckRequest
One HTTP request, as this package needs it.
AckResponse
One HTTP response.