Flutter
What the Sophonz Flutter SDK captures, how it sits on top of the Android and Apple SDKs, the packages it ships as, and the order to read this guide in.
The Sophonz Flutter SDK is a Flutter plugin that captures what happens in Dart — errors, navigation, network calls, frame drops, spans and logs — and hands it to the Sophonz Android SDK or the Sophonz Apple SDK underneath. The native SDK owns the session, captures native crashes and ANRs, and delivers everything to the collector as OpenTelemetry.
How it fits together
A Flutter app using the SDK runs two layers:
| Layer | Configured in | Responsible for |
|---|---|---|
Dart (sophonz package) | main.dart | Dart errors, routes, HTTP clients, frame and isolate hangs, custom spans and logs |
| Native SDK | sophonz-config.json (Android), Sophonz-Info.plist (iOS) | Session, device and app resources, native crashes, ANRs, native network calls, storage and upload |
Dart has no collector address and no service key. Both come from the native configuration, which is why setup touches the android/ and ios/ folders as well as pubspec.yaml.
CAUTION — The service key is what makes data arrive
The collector drops telemetry whose service key it cannot resolve, and it does so silently. An app built without a key starts normally, captures normally, and nothing reaches Sophonz. Set the key on both platforms before anything else.
What is captured
Captured by the Dart layer once Sophonz.instance.start() has run:
| Signal | Source | Needs |
|---|---|---|
| Uncaught Dart and Flutter errors | FlutterError.onError and PlatformDispatcher.onError | start(action: ...) |
| Time to first frame | spz-time-to-first-frame-flutter span | start(action: ...) |
| Slow and frozen frames | Frame timings; batched info logs and warning logs | nothing |
| UI isolate hangs | spz-dart-isolate-hang span when the event loop stalls for 700 ms | nothing |
| Background time | spz-app-background span | nothing |
| Routes | views, screen-load spans and time to interactive | SophonzNavigationObserver or SophonzGoRouterObserver |
| HTTP | network spans with the traceparent sent | SophonzHttpClient or SophonzInterceptor (Dio) |
Captured by the native SDK regardless of Dart: sessions, native crashes, ANRs (Android), hangs (iOS), app startup, and network calls made by native code. The full breakdown is in Instrumentation.
Packages
| Package | Use |
|---|---|
sophonz | The API your app imports |
sophonz_dio | Network capture for Dio 4.x and 5.x |
sophonz_go_router | Route tracking for go_router 6.x to 15.x, including StatefulShellRoute |
sophonz_android, sophonz_ios, sophonz_platform_interface | Pulled in by sophonz from the same tag. List sophonz_platform_interface yourself only to import ErrorCode or LastRunEndState |
The packages are distributed as git tags of sophonz-labs/sophonz-flutter-sdk, not on pub.dev. The current release is v0.1.0.
Requirements
| Item | Requirement |
|---|---|
| Flutter | 3.22 or higher |
| Dart | 3.4 or higher |
| Android | minSdk 21 (below 26, core library desugaring enabled); the Sophonz Gradle plugin 1.0.0 applied to the app module |
| iOS | 13.0 or higher; Sophonz Apple SDK (SophonzIO) 1.0.0 |
Reading order
- Installation — the git dependency, Android and iOS wiring, and the start calls
- Configuration —
sophonz-config.json,Sophonz-Info.plist, service identity and Dart options - Instrumentation — what is captured without code, and platform differences
- Navigation — routes with
Navigatoror go_router - Networking — HTTP capture and
traceparentpropagation to your backend - API reference — every public method, with platform support
- Release builds — mapping files, dSYMs and obfuscated Dart
- Examples — a complete app
- Upgrading — moving to a new release
Known gaps
NOTE — Not supported in 0.1.0
- iOS ignores user name and email.
setUserNameandsetUserEmailare accepted and dropped on iOS; the Apple SDK has no public API for them. The user identifier and personas work on both platforms. - Runtime exporters are Android-only.
addSpanExporterandaddLogRecordExporterdo nothing on iOS. Exporters there are configured natively at start. - Flutter routes do not set
app.screen.nameon iOS. Route views and spans are recorded, but other spans keep the name of the Flutter view controller. - Spans created through the OpenTelemetry API lose their parent, and
setStatus,updateNameandaddLinkare not implemented.Sophonz.instance.startSpanhas neither limit. - WebView session sharing is not wired for
webview_flutter. - Dart symbols are not uploaded. Builds with
--split-debug-infoor--obfuscatereport Dart stack traces that you resolve locally withflutter symbolize.
TIP — This is just the beginning
Now ship your app. Sophonz surfaces the problems real users hit — so your app evolves on its own.