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.5.1
debug_kit_go_router: ^0.2.2
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 path (query params masked)
- Previous route path where applicable
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.
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.2.x | ≥ 0.5.0 |
License
MIT