headers property
Global headers to be applied to all requests within this API.
These headers will be included in every request made through this API interface.
Method-level headers specified with @Headers will override these global headers
if they have the same key.
Example:
@RestApi(
baseUrl: "https://api.example.com",
headers: {
"User-Agent": "MyApp/1.0.0",
"X-Platform": "mobile",
},
)
abstract class ApiService {
@GET("/endpoint")
Future<Response> getData();
}
Implementation
final Map<String, dynamic>? headers;