NetworkEvent class

One captured HTTP request and its response or error, or one socket message when socketEvent is set.

Example:

for (final event in CorextraDevTools.instance.network.events) {
  print('${event.method} ${event.url} → ${event.statusCode} in ${event.duration?.inMilliseconds} ms');
}

Constructors

NetworkEvent({required String id, required String method, required String url, required DateTime startedAt, Map<String, String> queryParameters = const {}, Map<String, String> requestHeaders = const {}, Object? requestBody, Set<String> hiddenHeaderKeys = const {}, String? socketEvent})
Creates a captured request; usually made for you by NetworkEventStore.begin.

Properties

completedAt ↔ DateTime?
When the request finished, or null while it's still pending.
getter/setter pair
duration → Duration?
How long it took, or null while it's still pending.
no setter
errorMessage ↔ String?
What went wrong, or null when it succeeded.
getter/setter pair
errorType ↔ String?
The kind of failure, like connectionTimeout, or null when it succeeded.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
hiddenHeaderKeys → Set<String>
Lowercase header names the panel masks on screen; the real values are kept so Copy still works.
final
id → String
A unique id for this capture.
final
isError → bool
Whether it failed.
no setter
isPending → bool
Whether it's still waiting for a response.
no setter
isSocket → bool
Whether it's a socket message rather than an HTTP request.
no setter
method → String
The HTTP method, or for a socket message its direction: EMIT (sent by the app) or ON (pushed by the server).
final
queryParameters → Map<String, String>
The query parameters sent.
final
requestBody → Object?
The request body sent.
final
requestHeaders → Map<String, String>
The request headers sent, with their real values.
final
responseBody ↔ Object?
The response body received.
getter/setter pair
responseHeaders ↔ Map<String, String>
The response headers received.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
socketEvent → String?
The socket event name, like message:new, or null for HTTP.
final
startedAt → DateTime
When the request started.
final
statusCode ↔ int?
The HTTP status code, or null while pending or when it failed before a response.
getter/setter pair
statusMessage ↔ String?
The HTTP status message, like OK.
getter/setter pair
url → String
The request URL, or for a socket message the socket server's URL.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited