← All blogs

dust blog

Keep Auth Headers Beside the Endpoint

Manual authenticated Dio call beside a Dust HTTP client method using Header

Flutter’s networking docs show the normal first step: add an authorization header to the request.

That works. But as the API grows, the same header mapping starts to appear in many places.

Dust HTTP clients keep that detail beside the endpoint.

Use @Header('authorization') for caller-provided auth. Keep the path, query, body, and headers in one method signature. Then run dust build.

Your app still owns the token. Dio still sends the request. Dust only generates the repeated request mapping.

Read the Dust HTTP client guide.

#Dust #HTTPClient #Flutter #Dart #CodeGeneration