toJson method
Produces a Map that can be serialized to JSON.
Implementation
Map<String, dynamic> toJson() {
return <String, dynamic>{
if (headers.isNotEmpty) 'headers': headers,
if (cookies != null) 'cookies': cookies,
if (bodySize != null) 'body_size': bodySize,
if (statusCode != null) 'status_code': statusCode,
if (data != null) 'data': data,
};
}