Sorry if this question so basic, but I am new to flutter and recently couldn\'t find a good way to set a default headers in the HTTP request I can extend the class or wrap a fun
This can be easily made with the Dio package.
https://pub.dartlang.org/packages/dio
Update
Based on the new Dio API:
var dio = Dio();
dio.interceptors.add(InterceptorsWrapper(onRequest: (RequestOptions options) async {
var customHeaders = {
'content-type': 'application/json'
// other headers
};
options.headers.addAll(customHeaders);
return options;
}));
Response response = await dio.get("url");
print(response.data.toString());
Refer the documentation for more details.