debug_kit_go_router 0.4.1
debug_kit_go_router: ^0.4.1 copied to clipboard
GoRouter navigation logging adapter for DebugKit. Automatically logs navigation events with sanitization.
DebugKit GoRouter Adapter #
A GoRouter navigation logging adapter for DebugKit.
Automatically logs GoRouter navigation events (push, pop, replace, remove) into the DebugKit in-app console with query parameter sanitization.
Installation #
Add both debug_kit and debug_kit_go_router to your pubspec.yaml:
dependencies:
debug_kit: ^0.11.1
debug_kit_go_router: ^0.4.1
Setup #
Initialize DebugKit and add DebugKitGoRouterObserver to your GoRouter configuration:
import 'package:go_router/go_router.dart';
import 'package:debug_kit/debug_kit.dart';
import 'package:debug_kit_go_router/debug_kit_go_router.dart';
void main() {
DebugKit.init(enabled: true);
final router = GoRouter(
routes: [
// your routes...
],
observers: [
DebugKitGoRouterObserver(),
],
);
runApp(MyApp(router: router));
}
What is Logged #
- Navigation action:
push,pop,replace,remove - Sanitized route label/path (query params masked when present)
- Previous route label/path where applicable
- Route name and route type metadata when available
What is NOT Logged #
- Route
extraobjects — explicitly ignored to prevent PII leakage and avoid stringifying large payloads - Sensitive query parameters — values for keys like
token,password,api_keyare masked before logging
Security & Sanitization #
Route paths are sanitized using the same smart masking engine as the DebugKit core. Sensitive query parameter values are masked based on their length before being stored or displayed.
Console format still controls how these router summaries are rendered in the terminal, but it does not shorten developer-authored app logs.
Performance #
Zero overhead when DebugKit is disabled (enabled: false). The observer wraps all logging in a try/catch and will never throw or interrupt navigation.
Limitations #
- The observer captures events via the Flutter
NavigatorAPI, which GoRouter delegates to. Standard push/pop/replace/remove flows are fully supported. - Route
extrapayloads are never logged regardless of content.
Links #
Compatibility #
debug_kit_go_router |
debug_kit |
|---|---|
| 0.4.1 | ^0.11.0 |
| 0.4.0 | ^0.11.0 |
License #
MIT