ConsoleNetworkLogger class

Default logger that prints to the Dart developer console.

Only logs in debug mode. Respects prettyPrint for JSON formatting.

NetworkConfig(
  baseUrl: 'https://api.example.com',
  logger: const ConsoleNetworkLogger(),
)
Inheritance

Constructors

ConsoleNetworkLogger({bool prettyPrint = true, bool logHeaders = false, bool logBody = true})
const

Properties

hashCode int
The hash code for this object.
no setterinherited
logBody bool
final
logHeaders bool
final
prettyPrint bool
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

logError(String url, {dynamic error, int? statusCode}) → void
Called when a request fails (network error, timeout, etc.).
override
logRequest(RequestMethod method, String url, {Map<String, String>? headers, dynamic body}) → void
Called before the request is sent.
override
logResponse(int? statusCode, String url, {dynamic body, Duration? elapsed}) → void
Called after a successful response is received.
override
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