NetworkLogger class
Intercepts and logs HTTP requests and responses
Properties
-
allLogs
→ List<
NetworkLog> -
List of all network logs
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
logs
→ Stream<
NetworkLog> -
Stream of network logs
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clearLogs(
) → void - Clear all network logs
-
dispose(
) → void - Dispose the logger
-
getLogsByMethod(
String method) → List< NetworkLog> - Get logs filtered by HTTP method
-
getLogsByStatus(
int statusCode) → List< NetworkLog> - Get logs filtered by status code
-
getLogsByUrl(
String urlPattern) → List< NetworkLog> - Get logs filtered by URL pattern
-
logRequest(
{required String method, required String url, required Map< String, String> headers, String? body}) → void - Log a network request
-
logResponse(
{required String method, required String url, required int statusCode, required Map< String, String> headers, String? body, int? duration, String? error}) → void - Log a network response
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setMaxLogs(
int maxLogs) → void - Set the maximum number of logs to keep
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → NetworkLogger
-
no setter