NetworkLog class
One captured HTTP request/response cycle.
Produced by ShakeDioInterceptor (see package:shake_context/dio.dart)
or any custom adapter the host wires up via
ShakeContext.recordNetwork. The developer overlay shows these in a
dedicated panel, separate from text logs, so request bodies and status
codes stay scannable.
- Annotations
Constructors
-
NetworkLog({required String method, required String url, int? statusCode, int? durationMs, Map<
String, String> ? requestHeaders, Map<String, String> ? responseHeaders, String? requestBody, String? responseBody, String? error, DateTime? timestamp}) -
NetworkLog.fromJson(Map<
String, dynamic> json) -
Inverse of toJson. Defensive — wrong-typed or missing fields fall
back to their defaults rather than throwing.
factory
Properties
- durationMs → int?
-
Wall-clock duration of the request in milliseconds, when known.
final
- error → String?
-
Error message for transport-level failures (timeouts, DNS, cancelled).
Null for any response that came back, even a non-2xx one.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- isFailure → bool
-
True when the cycle did not complete with a 2xx status.
no setter
- method → String
-
HTTP verb —
GET,POST, etc. Uppercased by convention but not enforced.final - requestBody → String?
-
Request body as a string, when one was sent and the adapter chose to
serialise it. Adapters should run the body through
RedactionConfig.redactBody before passing it here.
final
-
requestHeaders
→ Map<
String, String> ? -
Request headers as captured by the adapter. The adapter is expected to
apply RedactionConfig before passing them here — the model itself
performs no masking. Null when the adapter did not capture headers.
final
- responseBody → String?
-
Response body as a string. Same redaction guidance as requestBody.
final
-
responseHeaders
→ Map<
String, String> ? -
Response headers as captured by the adapter. Same redaction guidance
as requestHeaders.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- statusCode → int?
-
Response status code, when the request completed.
Null while in-flight or on transport error.
final
- timestamp → DateTime
-
When the request was logged (start time, as observed by the adapter).
final
- url → String
-
Full request URL including query string.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
JSON-serializable representation. Null/empty optional fields are
omitted so the payload stays compact; required fields and timestamps
are always present. Safe to pass to
jsonEncodewithout further conversion, assuming the adapter passed JSON-compatible header values. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override