DioDebugLogger class

Main entry point of the package.

// 1) Dio
dio.addDebugLogger();

// 2) MaterialApp
MaterialApp(
  builder: DioDebugLogger.builder(),
);

Both are disabled in release builds by default.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

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

Static Properties

environment → String?
The selected environment name, or null when the app's own base URLs are used.
no setter
environments → DebugEnvironments
Environment registry (see dio.addDebugLogger(environments: ...)).
no setter
isOpen → bool
no setter
isOpenNotifier → ValueNotifier<bool>
Whether the log page is open. The floating button hides itself while it is.
final
Optional alternative to observer for locating the navigator.
getter/setter pair
observer → DebugNavigatorObserver
Optional: add to MaterialApp.navigatorObservers. Not required — the navigator is found automatically.
final
onEnvironmentChanged ← void Function(String? name)?
Called after the environment is switched (null = app default). A good place to log the user out if sessions don't carry over.
no getter
retryClientBuilder ↔ Dio Function()?
Creates the Dio used by the "Retry" button. Defaults to a plain Dio().
getter/setter pair
sensitiveKeys → Set<String>
Extra field names to mask, in addition to the built-in ones (passwords, tokens, keys, cookies, card data…):
no setter
storage → DebugStorage
The in-memory log storage.
no setter

Static Methods

builder({bool enabled = kDebugMode, TransitionBuilder? builder, Color? backgroundColor, Color? foregroundColor, IconData icon = Icons.bug_report_rounded, double buttonSize = 56, bool showBadge = true, Alignment initialAlignment = Alignment.centerLeft, bool snapToEdge = true}) → TransitionBuilder
A builder for MaterialApp.builder that shows the draggable debug button.
close([BuildContext? context]) → void
Closes all open debug routes.
configure({int? maxRequests}) → void
Changes how many requests are kept in memory (default 200).
createRetryClient([DebugModel? model]) → Dio
The Dio used to retry model: retryClientBuilder if set, otherwise the Dio that sent the request (keeps certificate pinning and options), otherwise a plain Dio().
interceptor({bool enabled = kDebugMode, bool printToConsole = kDebugMode, bool redactSensitiveHeaders = true, int maxConsoleBodyLength = 2000}) → Interceptor
The Dio interceptor. Prefer dio.addDebugLogger().
open([BuildContext? context]) → Future<void>
Opens the log page. Does nothing if it is already open.
setEnvironment(String? name) → Future<void>
Switches the environment from code. null goes back to the app default.
setEnvironments(List<DebugEnvironment> environments, {bool enabled = kDebugMode}) → void
Sets environments for every Dio that doesn't pass its own list to addDebugLogger. Call it in main() so the switcher is available before the first request (useful when Dio is created lazily).

Constants

routeName → const String
Route name of the log page.