Describe the bug
I'm trying to add static http headers to my API call like in the example.
@Headers(<String, dynamic>{
'Content-Type': 'application/json',
'Custom-Header': 'Your header',
})
But I'm getting an error 'Annotation must be either a const variable reference or const constructor invocation.'
Can someone help?
Steps to reproduce the behavior:
Add static http headers to any API call like below,
@GET('/api/endpoint')
@Headers(<String, dynamic>{
'Content-Type': 'application/json',
'Custom-Header': 'Your header',
})
Expected behavior
The headers must be added to the API request and should get success response.
Describe the bug I'm trying to add static http headers to my API call like in the example. @Headers(<String, dynamic>{ 'Content-Type': 'application/json', 'Custom-Header': 'Your header', }) But I'm getting an error 'Annotation must be either a const variable reference or const constructor invocation.' Can someone help?
Steps to reproduce the behavior: Add static http headers to any API call like below, @GET('/api/endpoint') @Headers(<String, dynamic>{ 'Content-Type': 'application/json', 'Custom-Header': 'Your header', })
Expected behavior The headers must be added to the API request and should get success response.