debug_kit 0.5.2
debug_kit: ^0.5.2 copied to clipboard
A mobile-first in-app DevTools/log console for Flutter apps with automatic sanitization and export support.
Changelog #
0.5.2 #
- fix: widen
share_plusconstraint to">=10.0.0 <14.0.0"(was^10.0.0) to allow apps using share_plus 11, 12, or 13. - fix: widen
intlconstraint to">=0.19.0 <0.21.0"(was^0.19.0) to allow apps using intl 0.20.x. - No runtime behavior changes. No API changes.
0.5.1 #
- chore: update
repositoryandissue_trackerURLs to reflect repository rename (username/debug_kit→username/debugkit).
0.5.0 #
New: Error Digest / Error Intelligence #
DebugKit now groups repeated and related errors into a digest so you can immediately see what failed, how often, and where — instead of scrolling through raw logs.
Error Digest Model
DebugErrorDigest: on-demand snapshot of all distinct error classes in the current session. ContainstotalErrors,uniqueErrors,failedTraceCount,failedNetworkCount, sortedentries,topRepeatedErrors, andlatestErrors.DebugErrorDigestEntry: a single grouped error class with:fingerprint,title,message,normalizedMessage,severity,source,count,firstSeenAt,lastSeenAt,relatedTraceIds,relatedTraceNames,relatedRequestIds,relatedRoutes,relatedProviderNames,latestError,latestStackTrace,firstUsefulStackFrame, andhealthHints.DebugErrorDigestSeverity:fatal,error,warning— used for sorting and color-coding in the UI.
Error Fingerprinting
DebugErrorFingerprintBuilder: stable, collision-resistant fingerprint strategy.- Dio errors: fingerprinted by
method|path|statusCode— different status codes never group; different paths never group. - Riverpod failures: fingerprinted by
provider_name|error_type_prefix— different providers never group. - App/trace errors: fingerprinted by
error_type_prefix|normalized_message|first_useful_frame. - Volatile values stripped: durations (
after 5000ms), UUIDs, memory addresses. DebugErrorFingerprintBuilder.normalizeMessage()is public for testing.
- Dio errors: fingerprinted by
Digest Builder
DebugErrorDigestBuilder.build(logs:, traces:): pure, stateless builder.- Sources errors from:
level == errorlogs, warning-level logs with anerrorfield, and failedDebugTraceinstances. DebugLogEntry.repeatCountcontributes to the digest entry count.- Collects related trace IDs/names, request IDs, route paths, and provider names from log metadata.
- Sorts entries: severity → count → most recent.
- Sources errors from:
Controller and Facade
DebugKitController.buildErrorDigest(): builds and returns aDebugErrorDigestfrom the current store snapshot. Returns an empty digest when disabled.DebugKit.errors.buildDigest(): public facade. On-demand — do not call on every frame.
Console UI: Errors Tab
- New Errors tab (third tab alongside Logs and Traces).
- Summary bar: unique error count, total occurrences, failed network count, failed trace count.
- Error list: severity badge, title, count badge (×N), source chip, last-seen time, first useful stack frame, related trace/provider/request chips.
- Error detail screen: full message, count, first/last seen, latest error, stack trace with first useful frame, related traces, request IDs, routes, providers, and health hints. Copy summary action.
- Empty state: "No errors detected" when no errors are present.
Export
.txtexport now includes aDebugKit Error Digestsection after the Traces section when errors are present.- Each entry exports: severity, source, count, first/last seen, error, frame, traces, requests, routes, providers, hints, and first 10 stack trace lines.
- Export is never expanded into N duplicate lines for grouped errors.
DebugLogExportFormatter.formatLogs()now accepts an optionaldigestparameter.DebugErrorDigestExportFormatteris available for standalone digest formatting.DebugLogFileExporter.exportToClipboard()andshareLogs()now accept an optionaldigestparameter — the console passes it automatically.
Security
- All digest fields contain only already-sanitized values from the store.
- No raw secrets, tokens, request/response bodies, route extras, or provider state objects are stored in any digest field.
- Fingerprinting operates on sanitized stored values — raw secrets never reach the comparison logic.
Performance
- Digest is computed on demand, not on every frame or every log append.
- Builder is pure and stateless — no background processing, no subscriptions.
- Disabled mode returns an empty digest immediately with zero overhead.
- No unbounded memory growth: the digest is a transient snapshot, not a store.
Example App
- New "Error Digest" section with: repeated error ×5, unique error, failed trace error, Dio 404 error — all visible in the Errors tab.
0.4.0 #
New: Repeated Log Grouping #
Consecutive identical log entries are now collapsed into a single row with a repeat counter, mirroring Chrome DevTools console behavior.
groupRepeatedLogsconfig option: enabled by default. PassgroupRepeatedLogs: falsetoDebugKit.init()to store every emission as an independent row.- Consecutive-only grouping: only back-to-back duplicates are merged.
A A B AbecomesA×2 · B · A— notA×3 · B. This is predictable and matches DevTools behavior. - Network logs never group: entries carrying a
requestId(all Dio logs) are always stored as separate rows. The Dio adapter updates each entry in-place byrequestId— merging concurrent identical requests would silently lose network transaction state. Each network entry occupies its own slot regardless ofgroupRepeatedLogs. DebugLogEntry.repeatCount: new field, defaults to1. Incremented by the store when a duplicate is detected.DebugLogEntry.lastSeenAt: new field. Set toDateTime.now()on each repeat;nullwhenrepeatCount == 1. The originaltimestampalways reflects the first occurrence.DebugLogEntry.fingerprint: new computed getter used by the store for grouping decisions. Includeslevel,source,message,error, first stack trace line,traceId, and stable metadata. Excludesid,timestamp,repeatCount,duration_ms, andresponse_headers.DebugLogEntry.copyWithRepeatIncrement: new helper used by the store.- Console UI:
×Nrepeat badge shown in the log tile header whenrepeatCount > 1. Expanded view shows Repeat, First seen, and Last seen blocks. Long-press copy includes×Nprefix. - Export: grouped entries export as a single block with
×Nin the header line andFirst seen/Last seentimestamps. Never expanded into N lines. maxLogscounting: grouped entries occupy one slot regardless of how many times the log was emitted. Repeats never trigger unnecessary eviction.- Example app: new "Repeat Log ×5" button demonstrates the feature.
Security #
- Fingerprint is computed on already-sanitized values — raw secrets never reach the comparison logic.
- Volatile metadata keys (
duration_ms,request_id,response_headers) are excluded from the fingerprint so network error retries group safely without leaking per-request data.
0.3.0 #
New: Trace System #
DebugKit.traceAPI: Full trace lifecycle —start(),step(),end(),fail(),cancel(), andrun().- Scoped async traces:
DebugKit.trace.run('name', callback)wraps async callbacks in a Dart Zone that propagates the active trace ID. Marks success on return, failure on throw, and always rethrows the original exception. - Nested traces:
parentTraceIdis automatically set whenrun()is called inside another activerun()zone. - Zone-based correlation: Logs, Dio requests, GoRouter navigation, and Riverpod failures emitted inside an active trace automatically carry
traceIdandtraceName. DebugTraceStore: Bounded in-memory store (default 50 traces, 200 events per trace). Evicts oldest completed traces when full.DebugTraceAnalyzer: Lightweight stateless health analyzer. Warns on failed traces, slow traces, stale running traces, failed network events, high event counts, and repeated errors.- Trace Console UI: New "Traces" tab in the DebugKit console. Shows trace list with status badge, duration, event count, and health indicator. Tap any trace to see its full timeline.
- Trace Detail Screen: Timeline of events with elapsed time, type badge, metadata, request IDs, and errors. Copy trace summary to clipboard.
- Export:
.txtexport now includes a full Traces section with timelines, health warnings, and a failed-trace summary. DebugKit.clearTraces(): Clears all in-memory traces.- New
DebugKit.init()parameters:maxTraces,maxTraceEventsPerTrace,slowTraceThreshold.
Security #
- All trace metadata, event messages, and error summaries are sanitized before storage.
- No request/response bodies, route extras, or provider state objects are stored in traces.
Performance #
- Trace store is bounded — no unbounded memory growth.
- Disabled mode is a strict no-op for all trace calls.
- No heavy processing in build methods;
ListView.builderused for all lists.
0.2.3 #
- Export: Filename format updated to
debugkit-logs-YYYYMMDD-HHMMSS.txt. - Export: Share button now exports filtered logs when filters are active.
- Export: Empty-log guard and share fallback to clipboard.
- Smart Masking: Length-aware masking algorithm.
- Natural Language Sanitization: Improved detection of secrets in plain text.
- Metadata Sanitization: Log metadata automatically sanitized.
0.2.1 #
- Overlay button: Improved drag clamping, larger touch target, gradient background, error state.
- Log tile: Colored left accent bar, chevron expand indicator, long-press-to-copy.
- Filter bar: Per-source colors, compact density.
- Console screen: Log count subtitle, distinct empty states.
0.2.0 #
- Added
DebugKit.clearLogs()andDebugKit.isEnabled. - Removed accidental public export of
DebugKitConsoleScreen.
0.1.0 #
- Initial MVP release.
New: Trace System #
DebugKit.traceAPI: Full trace lifecycle —start(),step(),end(),fail(),cancel(), andrun().- Scoped async traces:
DebugKit.trace.run('name', callback)wraps async callbacks in a Dart Zone that propagates the active trace ID. Marks success on return, failure on throw, and always rethrows the original exception. - Nested traces:
parentTraceIdis automatically set whenrun()is called inside another activerun()zone. - Zone-based correlation: Logs, Dio requests, GoRouter navigation, and Riverpod failures emitted inside an active trace automatically carry
traceIdandtraceName. DebugTraceStore: Bounded in-memory store (default 50 traces, 200 events per trace). Evicts oldest completed traces when full.DebugTraceAnalyzer: Lightweight stateless health analyzer. Warns on failed traces, slow traces, stale running traces, failed network events, high event counts, and repeated errors.- Trace Console UI: New "Traces" tab in the DebugKit console. Shows trace list with status badge, duration, event count, and health indicator. Tap any trace to see its full timeline.
- Trace Detail Screen: Timeline of events with elapsed time, type badge, metadata, request IDs, and errors. Copy trace summary to clipboard.
- Export:
.txtexport now includes a full Traces section with timelines, health warnings, and a failed-trace summary. DebugKit.clearTraces(): Clears all in-memory traces.- New
DebugKit.init()parameters:maxTraces,maxTraceEventsPerTrace,slowTraceThreshold.
Security #
- All trace metadata, event messages, and error summaries are sanitized before storage.
- No request/response bodies, route extras, or provider state objects are stored in traces.
Performance #
- Trace store is bounded — no unbounded memory growth.
- Disabled mode is a strict no-op for all trace calls.
- No heavy processing in build methods;
ListView.builderused for all lists.
0.2.3 #
- Export: Filename format updated to
debugkit-logs-YYYYMMDD-HHMMSS.txt. - Export: Share button now exports filtered logs when filters are active.
- Export: Empty-log guard and share fallback to clipboard.
- Smart Masking: Length-aware masking algorithm.
- Natural Language Sanitization: Improved detection of secrets in plain text.
- Metadata Sanitization: Log metadata automatically sanitized.
0.2.1 #
- Overlay button: Improved drag clamping, larger touch target, gradient background, error state.
- Log tile: Colored left accent bar, chevron expand indicator, long-press-to-copy.
- Filter bar: Per-source colors, compact density.
- Console screen: Log count subtitle, distinct empty states.
0.2.0 #
- Added
DebugKit.clearLogs()andDebugKit.isEnabled. - Removed accidental public export of
DebugKitConsoleScreen.
0.1.0 #
- Initial MVP release.