I have this Map of headers for sending http requests including cookies in header. I have log the changes data in console to make sure it is working.
This is my Map:
Map<String, String> headers = {};
I tried doing this but it is not working:
print(headers);
I am getting this message:
void print(Object? object)
CodePudding user response:
You just need to print entry by entry from the Map.
It would be like the following example:
final headers = <String, String>{
'AUTHORIZATION': 'test:test',
'ACCEPT': 'application/json'
};
void main() {
for (final e in headers.entries) {
print('${e.key} = ${e.value}');
}
}
OUTPUT
AUTHORIZATION = test:test
ACCEPT = application/json
CodePudding user response:
dart allow printing maps
check if you are printing headers map rather than something else
if you still have your problem maybe provide some code snippets ?