NetworkLog class
One captured network call, recorded by HttpInterceptor or
DioNetworkInterceptor and rendered by the Network tab.
Constructors
Properties
- duration → Duration
-
How long the call took, end to end.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isError → bool
-
True for a non-2xx response or a call that threw.
final
- isMocked → bool
-
True when this call was short-circuited by a mock rule instead of
reaching the network.
final
- method → String
-
The HTTP method (
'GET','POST', …).final - requestBody → dynamic
-
The outgoing body, in whatever shape the client handed over: Dio gives a
Map, a List or FormData, while the http client gives an encoded String.
Typing this as a Map made any http request with a body throw.
final
-
requestHeaders
→ Map<
String, dynamic> ? -
The outgoing request's headers, if any were captured.
final
- responseBody → dynamic
-
The response body, in whatever shape the client handed over — a
decoded
Map/Listfrom Dio, or a rawStringfrom the http client.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- startedAt → DateTime
-
When the call was made. Defaults to DateTime.now if omitted.
final
- statusCode → int?
-
The response's HTTP status code, or
null/negative for a call that never got one (e.g. it threw before a response arrived).final - statusGroup → int?
-
The response's status class: 2 for any 2xx, 4 for any 4xx, and so on.
no setter
- url → String
-
The request URL, as a string.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toCurl(
) → String -
Renders this call as a runnable
curlcommand. -
toHarEntry(
) → Map< String, dynamic> - Serializes this log as an HAR (HTTP Archive 1.2) entry map. Pass a list of these to NetworkLog.toHarDocument to get a full HAR file.
-
toJson(
) → Map< String, dynamic> - Serializes this call for export (e.g. copy-as-JSON in the Network tab).
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
toHarDocument(
List< NetworkLog> logs) → String - Wraps a list of NetworkLog entries into a complete HAR document string.