toMap method

Map<String, dynamic> toMap()

Converts the InfospectNetworkResponse object into a Map representation.

Returns a Map with the following key-value pairs:

  • 'status': The Network status code of the response (can be null if not set).
  • 'size': The size of the response data in bytes.
  • 'time': The timestamp when the response was received (in microseconds since epoch).
  • 'body': The body of the Network response.
  • 'headers': The headers of the Network response (can be null if not set).

Implementation

Map<String, dynamic> toMap() {
  return <String, dynamic>{
    'status': status,
    'size': size,
    'time': time.microsecondsSinceEpoch,
    'body': body is ResponseBody ? body.runtimeType.toString() : body,
    'headers': headers,
  };
}