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:

LayerConfigured inResponsible for
Dart (sophonz package)main.dartDart errors, routes, HTTP clients, frame and isolate hangs, custom spans and logs
Native SDKsophonz-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:

SignalSourceNeeds
Uncaught Dart and Flutter errorsFlutterError.onError and PlatformDispatcher.onErrorstart(action: ...)
Time to first framespz-time-to-first-frame-flutter spanstart(action: ...)
Slow and frozen framesFrame timings; batched info logs and warning logsnothing
UI isolate hangsspz-dart-isolate-hang span when the event loop stalls for 700 msnothing
Background timespz-app-background spannothing
Routesviews, screen-load spans and time to interactiveSophonzNavigationObserver or SophonzGoRouterObserver
HTTPnetwork spans with the traceparent sentSophonzHttpClient 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

PackageUse
sophonzThe API your app imports
sophonz_dioNetwork capture for Dio 4.x and 5.x
sophonz_go_routerRoute tracking for go_router 6.x to 15.x, including StatefulShellRoute
sophonz_android, sophonz_ios, sophonz_platform_interfacePulled 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

ItemRequirement
Flutter3.22 or higher
Dart3.4 or higher
AndroidminSdk 21 (below 26, core library desugaring enabled); the Sophonz Gradle plugin 1.0.0 applied to the app module
iOS13.0 or higher; Sophonz Apple SDK (SophonzIO) 1.0.0

Reading order

  1. Installation — the git dependency, Android and iOS wiring, and the start calls
  2. Configuration — sophonz-config.json, Sophonz-Info.plist, service identity and Dart options
  3. Instrumentation — what is captured without code, and platform differences
  4. Navigation — routes with Navigator or go_router
  5. Networking — HTTP capture and traceparent propagation to your backend
  6. API reference — every public method, with platform support
  7. Release builds — mapping files, dSYMs and obfuscated Dart
  8. Examples — a complete app
  9. Upgrading — moving to a new release

Known gaps

NOTE — Not supported in 0.1.0

  • iOS ignores user name and email. setUserName and setUserEmail are 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. addSpanExporter and addLogRecordExporter do nothing on iOS. Exporters there are configured natively at start.
  • Flutter routes do not set app.screen.name on 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, updateName and addLink are not implemented. Sophonz.instance.startSpan has neither limit.
  • WebView session sharing is not wired for webview_flutter.
  • Dart symbols are not uploaded. Builds with --split-debug-info or --obfuscate report Dart stack traces that you resolve locally with flutter 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.