ApiLogEntry class
Represents a captured API request and response log.
- Annotations
Constructors
-
ApiLogEntry({required String id, required String method, required String url, required Map<
String, String> requestHeaders, String? requestBody, int? statusCode, Map<String, String> ? responseHeaders, String? responseBody, required int durationMs, String? error, required DateTime timestamp, bool isOffline = false, bool isCompressed = false, Map<String, dynamic> ? deviceContext}) -
Creates a new immutable ApiLogEntry.
const
-
ApiLogEntry.create({required String id, required String method, required String url, required Map<
String, String> requestHeaders, required String? requestBody, required int? statusCode, required Map<String, String> ? responseHeaders, required String? responseBody, required int durationMs, required String? error, required DateTime timestamp, bool isOffline = false, int maxBodySize = 100 * 1024, bool enableCompression = true, Map<String, dynamic> ? deviceContext}) -
Factory constructor to create a new entry with intelligent compression/truncation logic.
factory
-
ApiLogEntry.fromDbMap(Map<
String, dynamic> map) -
Rebuild instance from a database row map
factory
-
ApiLogEntry.fromJson(Map<
String, dynamic> json) -
Create instance from standard JSON map
factory
Properties
-
deviceContext
→ Map<
String, dynamic> ? -
Optional contextual information about the device (OS, version, platform, etc.).
final
- durationMs → int
-
The total round-trip duration in milliseconds.
final
- error → String?
-
The error message or exception details if the request failed.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
The unique identifier of the log entry.
final
- isCompressed → bool
-
Whether the request or response body is stored compressed.
final
- isOffline → bool
-
Whether the device was offline when the request occurred.
final
- method → String
-
The HTTP method used (e.g. GET, POST, PUT, DELETE).
final
- requestBody → String?
-
The raw or truncated request body string.
final
-
requestHeaders
→ Map<
String, String> -
The map of HTTP request headers.
final
- responseBody → String?
-
The raw, truncated, or compressed response body string.
final
-
responseHeaders
→ Map<
String, String> ? -
The map of HTTP response headers.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- statusCode → int?
-
The HTTP response status code, or null if the request failed.
final
- timestamp → DateTime
-
The exact timestamp when this request was recorded.
final
- url → String
-
The full destination URL string.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toCurlCommand(
) → String - Generates a runnable cURL command string for the API request.
-
toDbMap(
) → Map< String, dynamic> - Convert to database map representation (with binary blob for compressed payload or stringified json)
-
toJson(
) → Map< String, dynamic> - Convert to raw JSON map suitable for exports (fully uncompressed plain text)
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited