Crash reporting for Flutter
Crash reporting with Sentry, configured once
One init under lib/app/observability, PII-free breadcrumbs, a router observer and obfuscated builds with uploaded debug symbols.
What this feature covers
- Error tracking: Uncaught exceptions captured with their real stack traces.
- Context: Breadcrumbs, tags and a PII-free user id.
- Tracing: A traces sampler, kept separate from the error sample rate.
- Network: An instrumented HTTP client for failed-request capture.
- Symbols: Obfuscated release builds with debug symbols uploaded from CI.
How Flutter Agent Kit implements it
All Sentry code lives under lib/app/observability/, with one bootstrapSentry() init. The DSN is injected with a dart-define rather than hardcoded, the SDK owns the Flutter binding, and error sampling stays at 1.0 so crashes are never silently dropped. Noise and PII filters run client-side before an event leaves the device.
A SentryNavigatorObserver is attached to the kit's gorouterProvider, and the instrumented HTTP client wraps the kit's http.Client, so routing and network failures are captured without extra plumbing. Production builds use --obfuscate --split-debug-info with symbols uploaded, so stack traces come back readable.
Frequently asked questions
Should the Sentry DSN be hardcoded?
No. The DSN is not a secret but it is never hardcoded, because a hardcoded value ships the wrong project to forks and tests. The kit injects it with --dart-define-from-file and reads it with String.fromEnvironment.
Why keep the error sample rate at 1.0?
Sampling errors means silently dropping user-impacting crashes, so the kit never samples them. If cost is a concern, traces are sampled with a tracesSampler instead, which is separate from the error sample rate.
Get Flutter Agent Kit
Flutter Agent Kit ships this as a ready feature skill, together with the AGENTS.md context layer and the rest of the skills. €99.99 one-time, lifetime updates, unlimited personal and commercial projects.
Browse all features included in Flutter Agent Kit.