toMap method

Map<String, dynamic> toMap()

Converts the InfospectNetworkCall object into a Map representation.

Returns a Map with the following key-value pairs:

  • 'id': The unique identifier for the Network call.
  • 'createdTime': The timestamp when the Network call was created (in microseconds since epoch).
  • 'client': The client information associated with the Network call.
  • 'loading': A flag indicating if the call is still in progress (loading) or completed.
  • 'secure': A flag indicating if the call is made over a secure (NetworkS) connection.
  • 'method': The Network method used in the call.
  • 'endpoint': The endpoint (URL path) used in the Network call.
  • 'server': The server URL (domain) to which the call is made.
  • 'uri': The full URI (server + endpoint) used in the Network call.
  • 'duration': The duration of the Network call in milliseconds.
  • 'request': The Map representation of the Network request data associated with the call.
  • 'response': The Map representation of the Network response data associated with the call.
  • 'error': The Map representation of the Network error data associated with the call (if any).

Implementation

Map<String, dynamic> toMap() {
  return <String, dynamic>{
    'id': id,
    'createdTime': createdTime.millisecondsSinceEpoch,
    'client': client,
    'loading': loading,
    'secure': secure,
    'method': method,
    'endpoint': endpoint,
    'server': server,
    'uri': uri,
    'duration': duration,
    'request': request?.toMap(),
    'response': response?.toMap(),
    'error': error?.toMap(),
  };
}