ResponseValidator typedef

ResponseValidator = ApiException? Function(Response response)

A callback that inspects a successful (2xx) response and either returns null to let it pass through, or returns an ApiException subclass to have the request fail with that exception.

Useful for legacy APIs that signal business errors via 200-OK responses with a payload like {"success": false, "error": "..."}.

Implementation

typedef ResponseValidator = ApiException? Function(
  Response<dynamic> response,
);