Implementation
Map<String, String> get toMap {
final headers = switch (this) {
_FormData(headers: final h) => h,
_Basic(headers: final h) => h,
_Data(headers: final h) => h,
};
final map = <String, String>{
'accept': 'application/json',
'content-type': switch (this) {
_FormData() => 'multipart/form-data; boundary=${_generateBoundary()}',
_Basic() => 'application/json; charset=utf-8',
_Data() => 'application/json; charset=utf-8',
},
};
if (headers != null && headers.isNotEmpty) {
map.addAll(headers);
}
return map;
}