diff --git a/cspell.json b/cspell.json index e17ead58..a12cbc1c 100644 --- a/cspell.json +++ b/cspell.json @@ -278,6 +278,16 @@ "RRGGBBAA", "Dalvik", "RSSI", - "Passpoint" + "Passpoint", + "libflutter", + "SIGEMT", + "appbundle", + "symdir", + "symbolizer", + "ttfb", + "cupertino", + "userinfo", + "Userinfo", + "referer" ] } \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index 688672a1..841713ee 100644 --- a/docs/index.md +++ b/docs/index.md @@ -13,7 +13,7 @@ Using Bugsee on mobile devices requires installation of Bugsee lightweight SDK: * [Installing Android SDK](/sdk/android/installation/) * [Installing Cordova SDK](/sdk/cordova/installation/) * [Installing React Native SDK](/sdk/react_native/v6/installation/) -* [Installing Flutter SDK](/sdk/flutter/installation/) +* [Installing Flutter SDK](/sdk/flutter/v9/installation/) * [Installing Unity SDK](/sdk/unity/installation/) * [Installing KMP SDK (Beta)](/sdk/kmp/installation/) * [Installing Xamarin SDK](/sdk/xamarin/installation/) — **deprecated**, use the [.NET SDK](/sdk/dotnet/installation/) for new projects @@ -136,7 +136,7 @@ Bugsee has a very rich feature set, yet on some platforms we managed to achieve View View View - View + View View View View @@ -147,7 +147,7 @@ Bugsee has a very rich feature set, yet on some platforms we managed to achieve View View - View + View View View @@ -158,7 +158,7 @@ Bugsee has a very rich feature set, yet on some platforms we managed to achieve View View View - View + View View View View @@ -169,7 +169,7 @@ Bugsee has a very rich feature set, yet on some platforms we managed to achieve View View View - View + View View View View @@ -180,7 +180,7 @@ Bugsee has a very rich feature set, yet on some platforms we managed to achieve View View View - View + View View View View @@ -191,7 +191,7 @@ Bugsee has a very rich feature set, yet on some platforms we managed to achieve View View View - View + View View View View @@ -202,7 +202,7 @@ Bugsee has a very rich feature set, yet on some platforms we managed to achieve View View View - View + View View View View diff --git a/docs/sdk/flutter/configuration.mdx b/docs/sdk/flutter/configuration.mdx new file mode 100644 index 00000000..0b785dcb --- /dev/null +++ b/docs/sdk/flutter/configuration.mdx @@ -0,0 +1,226 @@ +--- +title: "Configuration" +description: "The launch options of Bugsee Flutter SDK 10.x: BugseeOptions and its typed fields, one flat option map for both platforms, enums, the endpoint, and reading the effective options back." +sidebar_position: 2 +slug: "/sdk/flutter/configuration" +--- + +:::warning[Beta] +This page documents Bugsee Flutter SDK **10.x**, which is in beta, is not published on pub.dev yet and can change between betas. The stable release is **9.x**: see the [9.x documentation](/sdk/flutter/v9/installation). Upgrading? See [Migrating from 9.x to 10.x](/sdk/flutter/migration). +::: + +You configure the SDK with a `BugseeOptions` object passed to `Bugsee.launch`. One set of options configures both platforms: there are no separate Android and iOS option classes. + +```dart +import 'package:bugsee_flutter/bugsee_flutter.dart'; + +await Bugsee.launch( + 'YOUR_APP_TOKEN', + options: const BugseeOptions( + configDuration: 120, + captureLogsLevel: LogLevel.info, + configWifiOnlyUpload: true, + detectHang: true, + ), +); +``` + +## How options work + +`BugseeOptions` has a typed, documented field for every option the two native SDKs register, except the options of the leak module and most deprecated ones (`captureLogsOsLog` keeps its field, but the SDK accepts it and ignores it): 100 fields at the pinned SDK versions (Android 7.6.0, iOS 7.1.0). A field is named after its key: `capture.video.frame-rate` is `captureVideoFrameRate`. The fields are generated from the option manifests the two SDKs publish, so they cannot drift from the SDKs. + +- **A field you leave out keeps the SDK's own default.** Several defaults differ between Android and iOS; each field's documentation says which. +- **One configuration for both platforms.** An option that exists on one platform only (the video mode is Android's, the AVPlayer capture is iOS's) is ignored on the other, with a warning printed in debug builds. The same holds for an enum constant that one platform lacks (`FrameRate.raw` on iOS). +- **Stricter than the SDKs.** Both native SDKs silently drop an unknown key or a value of the wrong type. Here, an unknown key in `BugseeOptions.custom`, a hidden key, a value of the wrong type or a bad `endpoint` is an `ArgumentError` before anything reaches the SDK. `Bugsee.launch` surfaces it through its `Future`. +- **Keys are the SDK's.** Every option is keyed `com.bugsee.option.*`, the same keys on both platforms. The key of each field is in its documentation comment. + +### Options without a field + +`BugseeOptions.custom` is a map from full key to value, for options this version has no field for: the options of Bugsee modules this package does not bundle (the leak module) and the deprecated ones. A key that has a typed field is an `ArgumentError` when you also put it in `custom` ("set it in one place"). An option of a module the package does not bundle is sent, but the SDK ignores it unless your app adds that module, and a warning says so in debug builds. + +```dart +const BugseeOptions( + custom: {'com.bugsee.option.': true}, // a registered key without a typed field +); +``` + +Enum options in `custom` take the SDK's internal value (an `int`) or a constant name. Use a typed field when there is one. + +## Enums + +Enum options carry the SDK's internal value, never a Dart ordinal, so they read back from the SDK as integers. + +| Enum | Constants (value) | Platform | +| --- | --- | --- | +| `LogLevel` | `error` (1), `warning` (2), `info` (3), `debug` (4), `verbose` (5) | both | +| `FrameRate` | `low` (1), `medium` (2), `high` (3), `raw` (4, Android only) | both | +| `VideoQuality` | `defaultQuality` (0), `medium` (1), `high` (2) | both | +| `VideoMode` | `none` (0), `v1` (1), `v2` (2), `fullscreen` (20), `directBuffers` (21) | Android | +| `ReportSeverity` | `veryLow` (1), `medium` (2), `high` (3), `critical` (4), `blocker` (5) | both | +| `CrashHandlerType` | `bsd` (1), `mach` (2), `machAndBsd` (3) | iOS | +| `DataEncryptionMode` | `none` (0), `onDevice` (1), `endToEnd` (2) | iOS | +| `BugseeStyle` | `light` (0), `dusk` (1), `basedOnStatusBar` (2), `system` (3) | iOS | + +`ReportSeverity.low` is an alias of `veryLow`: value 1 is `VeryLow` on Android and `Low` on iOS. + +`captureCrashSignals` is an `int` bit set: `ABRT` 1, `SEGV` 2, `BUS` 4, `ILL` 8, `FPE` 16, `TRAP` 32 (63 is all six, `0` turns the selectable signals off). The package exports no constants for it: pass the numbers. The default, `128`, is a sentinel and not a mask: on its own it lets the SDK choose, which today is every signal. To leave out `SEGV` and `BUS`, pass `57`. On Android the value is read once, when the native crash handler is first armed in the process. + +## Endpoint + +`endpoint` is for an on-premises installation or a test server. Give the base URL, for example `https://bugsee.example.com`. A trailing slash and a `/v2` segment are removed, because both SDKs append the API version themselves. It must be an absolute `http` or `https` URL without a query or fragment; anything else is an `ArgumentError`. The endpoint is not one of the SDKs' public options, so it is not listed in uploaded reports and is not reachable through `custom`. + +## Option reference + +The tables list every typed field. "Platform" says where the option exists: `both`, `Android` or `iOS`. The SDK default is what the field keeps when you leave it out. A field's documentation comment has the full description and key. + +### Capture + +| Field | Type | Default | Platform | +| --- | --- | --- | --- | +| `captureAvPlayer` | `bool` | `false` | iOS | +| `captureBluetoothStatus` | `bool` | `false` | iOS | +| `captureBreadcrumbs` | `bool` | `false` | both | +| `captureBreadcrumbsExtras` | `bool` | `false` | both | +| `captureCameraPreview` | `bool` | `false` | iOS | +| `captureCrashHandlerType` | `CrashHandlerType` | `CrashHandlerType.machAndBsd` | iOS | +| `captureCrashSignals` | `int` | `128` | both | +| `captureDeviceNetworkNames` | `bool` | `false` | iOS | +| `captureDiskSpace` | `bool` | `false` | iOS | +| `captureLogs` | `bool` | `true` | both | +| `captureLogsAllSources` | `bool` | `false` | Android | +| `captureLogsLevel` | `LogLevel` | `LogLevel.verbose` | both | +| `captureLogsOsLog` | `bool` | `false` | iOS (deprecated: accepted and ignored) | +| `captureNetwork` | `bool` | `true` | both | +| `captureNetworkBodySizeLimit` | `int` | `20480` | both | +| `captureNetworkBodyWithoutType` | `bool` | `false` | both | +| `captureNetworkDefaultSanitizer` | `bool` | `true` | both | +| `captureNetworkOnLaunch` | `bool` | `false` | both | +| `captureOnDeviceSymbolication` | `bool` | `false` | iOS | +| `captureRespectFlagSecure` | `bool` | `true` | Android | +| `captureSampleBufferDisplayLayer` | `bool` | `false` | iOS | +| `captureScreenshot` | `bool` | `true` | both | +| `captureScreenshotScale` | `double` | `1.0` | both | +| `captureStatusBarInfo` | `bool` | `false` | iOS | +| `captureVideo` | `bool` | `true` | both | +| `captureVideoAdaptive` | `bool` | `false` (Android), `true` (iOS) | both | +| `captureVideoCustomMuxer` | `bool` | `false` | Android | +| `captureVideoFrameRate` | `FrameRate` | `FrameRate.high` | both | +| `captureVideoFullscreenKeepRunning` | `bool` | `true` | Android | +| `captureVideoFullscreenRememberDecision` | `bool` | `true` | Android | +| `captureVideoMaxFrameRate` | `int` | `0` | iOS | +| `captureVideoMinFrameRate` | `int` | `0` | iOS | +| `captureVideoMode` | `VideoMode` | `VideoMode.v2` | Android | +| `captureVideoPrivacyBlur` | `bool` | `true` | iOS | +| `captureVideoQuality` | `VideoQuality` | `VideoQuality.defaultQuality` | both | +| `captureVideoScale` | `double` | `1.0` | both | +| `captureVideoSecureScrolling` | `bool` | `false` | Android | +| `captureViewHierarchy` | `bool` | `true` | both | +| `captureWebSocket` | `bool` | `true` | iOS | +| `captureWebViewAdvanced` | `bool` | `true` | both | +| `captureWebViewReportTrigger` | `bool` | `false` | both | + +### Storage and upload + +| Field | Type | Default | Platform | +| --- | --- | --- | --- | +| `configBuildTarget` | `String` | `none` | iOS | +| `configBuildType` | `String` | `none` | iOS | +| `configDataEncryption` | `DataEncryptionMode` | `DataEncryptionMode.none` | iOS | +| `configDuration` | `int` | `60` | both | +| `configMaxDataSize` | `int` | `150` | both | +| `configMaxPendingReportAge` | `int` | `30` | both | +| `configMaxPendingReports` | `int` | `30` | both | +| `configNotifyFlushDelay` | `int` | `0` | both | +| `configReportHandlerCallbackTimeout` | `int` | `30` | Android | +| `configReportProcessingInProcess` | `bool` | `true` | Android | +| `configWifiOnlyUpload` | `bool` | `false` | both | + +### Detection + +| Field | Type | Default | Platform | +| --- | --- | --- | --- | +| `crashNdkTombstoneLogs` | `bool` | `false` | Android | +| `detectAnomaly` | `bool` | `false` | both | +| `detectAnrSampling` | `bool` | `true` | Android | +| `detectCrash` | `bool` | `true` | both | +| `detectCrashNdk` | `bool` | `true` | Android | +| `detectCrashFillEmptyExceptionStacks` | `bool` | `false` | iOS | +| `detectCrashSwiftAsyncStackTraces` | `bool` | `true` | iOS | +| `detectEarlyCrash` | `bool` | `true` | both | +| `detectExit` | `bool` | `true` | both | +| `detectExitBgLowMemoryAsError` | `bool` | `false` | Android | +| `detectExitDependencyDied` | `bool` | `false` | Android | +| `detectExitExcessiveResourceUsage` | `bool` | `false` | Android | +| `detectExitLowMemory` | `bool` | `true` | Android | +| `detectExitNotResponding` | `bool` | `true` | Android | +| `detectExitNotRespondingAsCrash` | `bool` | `false` | Android | +| `detectExitOther` | `bool` | `false` | Android | +| `detectExitPackageStateChanged` | `bool` | `false` | Android | +| `detectExitPackageUpdated` | `bool` | `false` | Android | +| `detectExitPermissionChanged` | `bool` | `false` | Android | +| `detectExitUnknown` | `bool` | `false` | Android | +| `detectExitUserRequested` | `bool` | `false` | Android | +| `detectExitUserWasStopped` | `bool` | `false` | Android | +| `detectFrustration` | `bool` | `false` | both | +| `detectHang` | `bool` | `false` | both | +| `detectHangLevelFair` | `int` | `3000` | both | +| `detectHangLevelMedium` | `int` | `5000` | both | +| `detectHangLevelSevere` | `int` | `10000` | both | +| `detectHangSampling` | `bool` | `true` | Android | +| `detectHttpErrors` | `bool` | `false` | both | +| `detectMainThreadMisuse` | `bool` | `false` | both | + +### Performance (APM) + +| Field | Type | Default | Platform | +| --- | --- | --- | --- | +| `performanceAdaptiveSampling` | `bool` | `true` | both | +| `performanceEnabled` | `bool` | `true` | both | +| `performanceSampleRate` | `double` | `0.01` | both | +| `performanceUploadMode` | `String` | `'batched'` | Android | + +### Reporting and triggers + +| Field | Type | Default | Platform | +| --- | --- | --- | --- | +| `reportingDefaultsBugPriority` | `ReportSeverity` | `ReportSeverity.high` | both | +| `reportingDefaultsCrashPriority` | `ReportSeverity` | `ReportSeverity.blocker` | both | +| `reportingDefaultsErrorPriority` | `ReportSeverity` | `ReportSeverity.high` | both | +| `reportingTriggersBroadcast` | `bool` | `false` | Android | +| `reportingTriggersNotificationBar` | `bool` | `false` | Android | +| `reportingTriggersScreenshot` | `bool` | `false` | both | +| `reportingTriggersShake` | `bool` | `false` | both | +| `reportingUiDescriptionRequired` | `bool` | `false` | both | +| `reportingUiEmailRequired` | `bool` | `false` | both | +| `reportingUiLabelsEnabled` | `bool` | `false` | both | +| `reportingUiLabelsRequired` | `bool` | `false` | both | +| `reportingUiPrioritySelectorEnabled` | `bool` | `false` | both | +| `reportingUiStyle` | `BugseeStyle` | `BugseeStyle.system` | iOS | +| `reportingUiSummaryRequired` | `bool` | `false` | both | + +## Reading the options back + +```dart +final inEffect = await Bugsee.getLaunchOptions(); +final supplied = await Bugsee.getHostLaunchOptions(); +``` + +| Method | Returns | +| --- | --- | +| `getLaunchOptions()` | The options in effect: what your app supplied, merged over the SDK's defaults. Before the first launch these are the SDK's defaults. The same on both platforms. | +| `getHostLaunchOptions()` | The options your app supplied to the last launch, without the defaults; empty before the first launch. Replaced, not merged, by the next launch. | + +Both are keyed by `com.bugsee.option.*`. Enums come back as the SDK's internal integer, and floats as `double` with the precision of a 32-bit float. Internal options (`$$ENDPOINT`, `$$WRAPPER`, `$$DEBUG`) are never included. + +`getHostLaunchOptions()` differs between the platforms and is not normalised: Android reports every recognised option you passed, iOS only those whose value differs from the iOS default. On iOS, an option absent from it does not mean you did not set it. Use `getLaunchOptions()` for what is in effect. + +## Options and the launch result + +Options apply only when the launch happens. When `Bugsee.launch` returns `alreadyRunning` (a second launch, or Android auto-init), your options were **not applied**; see [Installation](/sdk/flutter/installation#launching-twice-and-auto-init). To change options, `await Bugsee.stop()` and launch again. + +## Related pages + +- [Installation](/sdk/flutter/installation): the first launch. +- [Lifecycle & status](/sdk/flutter/lifecycle): launch results, stop and status. +- [Network capture](/sdk/flutter/network), [Console logs](/sdk/flutter/logs): the options that gate them. +- [Privacy](/sdk/flutter/privacy/overview): the capture options behind the privacy controls. diff --git a/docs/sdk/flutter/dart-errors.md b/docs/sdk/flutter/dart-errors.md new file mode 100644 index 00000000..53498f4c --- /dev/null +++ b/docs/sdk/flutter/dart-errors.md @@ -0,0 +1,133 @@ +--- +title: "Dart errors" +description: "Capture the Dart errors nobody handled with Bugsee Flutter SDK 10.x: installErrorHandlers, runGuarded, listenToIsolateErrors, how the handlers chain with Crashlytics and Sentry, and their limits." +sidebar_position: 6 +slug: "/sdk/flutter/dart-errors" +--- + +:::warning[Beta] +This page documents Bugsee Flutter SDK **10.x**, which is in beta, is not published on pub.dev yet and can change between betas. The stable release is **9.x**: see the [9.x documentation](/sdk/flutter/v9/installation). Upgrading? See [Migrating from 9.x to 10.x](/sdk/flutter/migration). +::: + +`Bugsee.installErrorHandlers` reports the Dart errors that reach the framework's last-resort hooks, without wrapping every call in `try`/`catch`. It is **opt-in**: `launch` never installs it. For errors you catch yourself, see [Crash & error reporting](/sdk/flutter/manual/crash-error-reporting). + +```dart +import 'package:bugsee_flutter/bugsee_flutter.dart'; +import 'package:flutter/material.dart'; + +void main() { + // The bindings and runApp share the guarded zone, so Flutter finds no zone mismatch. + Bugsee.runGuarded(() async { + WidgetsFlutterBinding.ensureInitialized(); + await Bugsee.launch(''); + + // Opt in to the errors nobody handled. Chained: your handlers still run. + Bugsee.installErrorHandlers(); + assert(Bugsee.errorHandlersActive); // false when another tool replaced them + + runApp(const MyApp()); + }); +} +``` + +## What is hooked + +```dart +Bugsee.installErrorHandlers({ + bool flutterErrors = true, + bool platformErrors = true, + bool isolateErrors = true, + bool reportAsCrash = false, +}); +``` + +| Argument | Hooks | Covers | +| --- | --- | --- | +| `flutterErrors` | `FlutterError.onError` | Errors the framework catches (build, layout, paint, gesture). | +| `platformErrors` | `PlatformDispatcher.instance.onError` | Uncaught asynchronous errors of the root zone. | +| `isolateErrors` | The root isolate's error listener | Uncaught errors of the root isolate. | +| `reportAsCrash` | none | See [Error or crash reports](#error-or-crash-reports). | + +Errors in a zone you create need `Bugsee.runGuarded`, and errors in isolates you spawn need `Bugsee.listenToIsolateErrors`. Both are described below. + +`Bugsee.uninstallErrorHandlers()` removes the hooks. `Bugsee.errorHandlersInstalled` says that `installErrorHandlers` was called and not undone; `Bugsee.errorHandlersActive` says that the hooks are in effect **and** are still the current `FlutterError.onError` and `PlatformDispatcher.onError` (see [Order of installation](#order-of-installation)). A second `installErrorHandlers` while installed does nothing, and a hot restart starts clean. + +## Handlers chain, they never replace + +The handler that was installed before (yours, Crashlytics', Sentry's) is still called and its answer is returned. With none, `PlatformDispatcher.onError` answers `false`, so the engine reports the error as it would have without Bugsee. + +- For `FlutterError.onError` Bugsee's part runs first, and reports even if the previous handler throws. +- For `PlatformDispatcher.onError` the previous handler runs first, because its answer decides what the error is: an error the previous handler answers `true` for (the app handled it) is **never** filed as a crash, whatever `reportAsCrash` says. The report is made even when that handler throws, and its exception goes on to the app. +- Bugsee's part never throws and never blocks. A failure while reporting is swallowed and does not report itself. +- `uninstallErrorHandlers` puts the previous handlers back only if Bugsee's are still the current ones. If another tool wrapped them since, they cannot be unlinked: they stay in that tool's chain and pass every error on, reporting nothing. + +### Order of installation + +**Install after the tools that assign these handlers.** Crashlytics' documented setup (`FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterFatalError`, `PlatformDispatcher.instance.onError = ...`) **replaces** whatever handler is there, so a Bugsee installed before it is dropped from the chain and reports nothing. Sentry's `init` wraps the current handler and keeps Bugsee's. + +```dart +await Firebase.initializeApp(); +FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterFatalError; +PlatformDispatcher.instance.onError = (error, stack) { + FirebaseCrashlytics.instance.recordError(error, stack, fatal: true); + return true; +}; + +// After Crashlytics, so Bugsee is in the chain. +Bugsee.installErrorHandlers(); +``` + +`errorHandlersActive` is `false` when another tool replaced the handlers (a debug build also prints a warning at `Bugsee.launch`). It is also `false` when a tool wrapped them: in that case Bugsee still reports whenever the wrapper calls through, which cannot be told from here. + +## Error or crash reports + +By default the handlers file **error** reports (`reportAsCrash: false`). A Dart error never ends the app, and a crash report counts against crash-free sessions, so every non-silent `FlutterError` (an image that fails to load offline) would. `installErrorHandlers(reportAsCrash: true)` files crash reports instead, which is what 9.x did for `FlutterError.onError`. See [Crash & error reporting](/sdk/flutter/manual/crash-error-reporting#error-or-crash) for the difference on each platform. + +`FlutterErrorDetails.silent` errors are skipped. Nothing is reported while the last launch made through `Bugsee.launch` had `detect.crash` set to `false`. + +## Once per error, and limits on floods + +- The same throw reaching the handlers by two routes within a second (an uncaught root-zone error reaches both `PlatformDispatcher.onError` and the isolate listener) is **one** report. +- The same error (same first line of the message and top frames) is reported at most once in 30 seconds. +- At most 10 reports in 60 seconds, across all errors. +- 64 distinct errors are remembered, so a render error that repeats every frame opens one report, not sixty. + +Explicit `logException` calls are not limited. + +## What is read + +Only the exception and its stack are read from `FlutterErrorDetails`. The information collector (the widget trees), the `context` and the `library` are not read. A `FlutterError` contributes its summary; any other object its `toString()`; file paths are reduced to the file name. Details are in [Crash & error reporting](/sdk/flutter/manual/crash-error-reporting#what-the-report-contains). + +## Zones: `runGuarded` + +```dart +Bugsee.runGuarded( + () => runApp(const MyApp()), + onError: (error, stack) => debugPrint('escaped: $error'), +); +``` + +`runGuarded(R Function() body, {void Function(Object error, StackTrace stack)? onError})` is `runZonedGuarded` that reports what escapes `body` (errors from timers and futures started in it) and then calls `onError`. Without `onError` the error goes to `FlutterError.reportError`, so it is still printed and still reaches your handlers. It reports like the installed handlers do (an error report, or a crash report when `reportAsCrash: true`). The zone also records `print` output once [log capture](/sdk/flutter/logs) is installed. It returns `null` if the zone ends with an error. + +## Isolates: `listenToIsolateErrors` + +Errors in an isolate you spawn do not reach the root handlers. Start the isolate paused, add the listener, then resume it: an isolate that exits first is missed. + +```dart +final isolate = await Isolate.spawn(worker, null, paused: true); +final listener = Bugsee.listenToIsolateErrors(isolate); +isolate.resume(isolate.pauseCapability!); + +// Later, when you no longer need it +listener.cancel(); +``` + +It works whether or not `installErrorHandlers` was called. + +## Limits + +- **Before `launch` and after `stop`** an error is dropped, not queued. Install the handlers before `launch` anyway: they cost nothing until an error happens, but reports start when the SDK does. +- **Several engines or isolates.** The handlers are Dart statics of one isolate; an engine started later needs its own install. +- **iOS Simulator.** Nothing is filed for a Dart error. +- **iOS crash reports** (`reportAsCrash: true`) arrive at the next launch, and each replaces the single stored one. +- **Android launched natively** (manifest auto-init) is not seen by the `detect.crash` gate. diff --git a/docs/sdk/flutter/events-and-traces.md b/docs/sdk/flutter/events-and-traces.md new file mode 100644 index 00000000..715572ee --- /dev/null +++ b/docs/sdk/flutter/events-and-traces.md @@ -0,0 +1,135 @@ +--- +title: "Custom events & traces" +description: "Record custom events, traces, log lines, breadcrumbs and notifications with Bugsee Flutter SDK 10.x: Bugsee.event, trace, log, addBreadcrumb and notify, the values they accept, and what is dropped before launch." +sidebar_position: 10 +slug: "/sdk/flutter/events-and-traces" +--- + +:::warning[Beta] +This page documents Bugsee Flutter SDK **10.x**, which is in beta, is not published on pub.dev yet and can change between betas. The stable release is **9.x**: see the [9.x documentation](/sdk/flutter/v9/installation). Upgrading? See [Migrating from 9.x to 10.x](/sdk/flutter/migration). +::: + +Besides what Bugsee captures automatically, you can add your own signals to the session a report replays: + +- **Events** mark that something happened (`checkout`, `onboarding_skipped`), optionally with parameters. +- **Traces** follow how one value changes over time (`cart-size`, `logged-in`), so you can see its state right before a problem. +- **Log lines** are your own deliberate lines in the report's log. +- **Breadcrumbs** are a trail of what the user did (off by default). +- **Notifications** go to your Slack or Teams integration without creating a report. + +All of them are `Future`-returning statics on `Bugsee` and assume `import 'package:bugsee_flutter/bugsee_flutter.dart';`. An invalid argument is reported through the `Future` as a `BugseeArgumentException`, before anything reaches the SDK. + +**Nothing is held until launch.** `event`, `trace`, `log` and `addBreadcrumb` are dropped before `Bugsee.launch` and after `Bugsee.stop`; `notify` is ignored (the SDK logs it). Nothing is queued and nothing throws. Record them after `launch`. + +## Custom events + +`Bugsee.event(name, [params])` records a named event on the report timeline: + +```dart +// Without parameters +await Bugsee.event('payment_processed'); + +// With parameters +await Bugsee.event('payment_processed', { + 'amount': 125, + 'currency': 'USD', + 'items': [ + {'sku': 'A-100', 'quantity': 2}, + ], + 'coupon': null, +}); +``` + +`name` must not be empty. `params` is a `Map`; leave it out for an event without parameters. Its values may be `null`, `bool`, `num`, `String`, and `List`s and `Map`s of those. + +| Rule | Detail | +| --- | --- | +| Numbers | Finite and below 2^63 in magnitude. | +| Depth | At most 16 levels. | +| Rejected | A cycle, a non-string map key or any other type. The `BugseeArgumentException` names the path of the bad value, for example `params.a.b[1]`. | +| Copy | The map is copied, so changing it afterwards changes nothing. | +| `null` values | A `null` member stays a `null` member on both platforms. | + +## Traces + +`Bugsee.trace(name, value)` records the value of a named signal at this moment: + +```dart +await Bugsee.trace('cart-size', 3); +await Bugsee.trace('logged-in', true); +await Bugsee.trace('last-screen', 'checkout'); +``` + +`value` is a `String`, `bool`, `int` or a finite `double` below 2^63 in magnitude. Call it each time the value changes. + +## Log lines + +`Bugsee.log(message, {level = LogLevel.info})` adds a line to the report's log: + +```dart +await Bugsee.log('payment declined', level: LogLevel.warning); +``` + +`LogLevel` has `error`, `warning`, `info`, `debug` and `verbose`. This is the app-level log: it does not print to the console, it is recorded as your application's own deliberate line (source `Bugsee`), and it bypasses the log filter. The capture of Dart's `print` and `debugPrint` is separate and recorded with another source; see [Console logs](/sdk/flutter/logs). + +## Breadcrumbs + +A breadcrumb is a short entry in the report's trail ("opened the cart", "navigated to /settings"). Breadcrumb capture is **off by default** on both SDKs. Turn it on at launch with `captureBreadcrumbs`: + +```dart +await Bugsee.launch( + '', + options: const BugseeOptions(captureBreadcrumbs: true), +); + +final taken = await Bugsee.addBreadcrumb( + const BugseeBreadcrumb( + category: 'nav', + message: 'opened cart', + level: BreadcrumbLevel.info, + type: 'navigation', + data: {'items': 3}, + ), +); +``` + +| `BugseeBreadcrumb` field | Notes | +| --- | --- | +| `category` | Required. A short grouping such as `navigation`, `ui` or `http`. | +| `message` | Required. | +| `level` | A `BreadcrumbLevel`: `debug`, `info` (default), `warning`, `error` or `fatal`. iOS has no `fatal` level and records it as `error`. | +| `type` | The kind of entry; default `'default'` (for example `user`, `navigation`, `error`). | +| `data` | Optional extra values; the same types as event parameters. | + +The `Future` completes with whether the SDK was handed the breadcrumb. `false` means it was not: capture is off, or the SDK is not launching or launched (before launch and after `stop`). `true` is not proof that it is recorded, because a native breadcrumb filter set by your app may still drop it. `captureBreadcrumbsExtras` (default `false`) adds the raw notification payload to automatically collected device-event breadcrumbs. + +The SDK also collects its own breadcrumbs when capture is on. On Android these include `http` breadcrumbs. In the maintainers' measurement Android kept the query of the `http` breadcrumb URL; the SDK option documentation says the default sanitizer also redacts it; this was not re-measured at Android 7.6.0. Redact the URL in the network filter, which runs first. See [Network privacy](/sdk/flutter/privacy/network#http-breadcrumbs). + +## Notifications + +`Bugsee.notify` sends a message to the messaging integrations configured for your app (Slack, Teams, and so on) without creating a bug report: no video, logs or events are attached. + +```dart +await Bugsee.notify( + 'Deploy finished', + body: 'v2.1 is live', + severity: ReportSeverity.medium, + fields: {'environment': 'production', 'build': '4821'}, + urgent: false, +); +``` + +| Argument | Type | Notes | +| --- | --- | --- | +| `title` | `String` | Required, must not be blank. | +| `body` | `String?` | Optional text. | +| `severity` | `ReportSeverity?` | Optional. | +| `fields` | `Map?` | Extra rows. Order is kept on Android; iOS takes an unordered dictionary. | +| `urgent` | `bool` | Default `false`. The SDK keeps a notification on the device and uploads in batches, so nothing is lost offline; `true` posts it at once, ahead of older queued ones, when a session and a network exist. | + +Ignored before `launch`: the SDK logs a line and drops it. + +## Limits + +- Write-only calls (`event`, `trace`, `log`, `notify`) have no read-back in the SDKs. The calls complete without error while launched; whether and how they appear in the dashboard is the SDK's. +- Nothing is queued: a call before `launch` or after `stop` is lost. diff --git a/docs/sdk/flutter/faq.md b/docs/sdk/flutter/faq.md new file mode 100644 index 00000000..69d67903 --- /dev/null +++ b/docs/sdk/flutter/faq.md @@ -0,0 +1,162 @@ +--- +title: "FAQ" +description: "Questions and answers about Bugsee Flutter SDK 10.x (beta): supported platforms, limits, what is not captured, build problems and symbolication." +sidebar_position: 23 +slug: "/sdk/flutter/faq" +--- + +:::warning[Beta] +This page documents Bugsee Flutter SDK **10.x**, which is in beta, is not published on pub.dev yet and can change between betas. The stable release is **9.x**: see the [9.x documentation](/sdk/flutter/v9/installation). Upgrading? See [Migrating from 9.x to 10.x](/sdk/flutter/migration). +::: + +Upgrading from 9.x? See the [migration guide](/sdk/flutter/migration). + +## Platforms and limits + +**1. Which Flutter, Android and iOS versions does 10.x need?** + +Flutter 3.50.0 or newer (Dart 3.14). Android `minSdk` 21, built with JDK 17 or 21 and the Bugsee Gradle plugin 4.1.1. iOS 15.0 or newer, with Swift Package Manager only: Bugsee publishes no CocoaPods pod and the plugin has no podspec. The native SDKs are Android 7.6.0 and iOS 7.1.0. See [Installation](/sdk/flutter/installation). + +
+ +**2. Does it work on web, desktop, tvOS or visionOS?** + +No. On web and desktop the calls do nothing and `launch` throws. tvOS and visionOS are not covered. + +
+ +**3. Can I call Bugsee from a background isolate?** + +The API works from the main isolate. A call from a background isolate throws a `BugseeException`. Network and log capture and the error handlers belong to the isolate that installed them. To report errors of an isolate you spawn, use `Bugsee.listenToIsolateErrors`. Hot restart is handled: a new isolate takes over. See [Dart errors](/sdk/flutter/dart-errors). + +
+ +**4. How much of this has been tested on real devices?** + +Partly. Most of the evidence comes from Android emulators (API 28 to 33) and iOS simulators (iOS 26.5 and 27.0). Integration tests also ran on one Android 14 phone, an iPhone XS and an iPhone 16 Pro. On the phones, `view_hierarchy_test` fails on the debug builds of the Android phone and the iPhone XS (it passes in profile builds), and the iPhone 16 Pro ran only the `attachments`, `network` and `logs` tests. The recovered-crash scenarios for iOS exception bundles were not run on a phone. Treat device behavior as beta. + +
+ +**5. Why do I see no crashes or Dart errors from the iOS simulator?** + +The SDK's simulator slice has no crash reporter and files no logged exceptions, so crash recovery and Dart error reports cannot be tried there. Use a physical iPhone. Release and profile builds cannot run on a simulator at all. + +
+ +**6. Is a newly appearing secure region hidden from the very first frame?** + +No. A [`BugseeSecureView`](/sdk/flutter/privacy/video) does not cover the first frame of a region that has just appeared, or pixels drawn outside its subtree (an `Overlay` magnifier or tooltip). Secure regions are verified in portrait on iOS only. + +
+ +**7. Why is the start of an Android session missing?** + +The SDK holds capture from process start until the first Flutter frame is up and the secure rectangles are published, about 1 second after it. Time caps end the hold: 10 s after the last engine that attached before a frame, 20 s when none attached, and 60 s at most. The first seconds of a session are therefore not recorded. + +## What is captured + +**8. Why do my events, traces, logs, notifications or uploads vanish?** + +They are dropped before `launch` and after `stop`. Nothing is queued. Attributes, the user identifier and blackout work before launch. See [Lifecycle](/sdk/flutter/lifecycle). + +
+ +**9. Why is nothing captured from `dart:io`, `print` or Dart errors?** + +Those are opt-in in 10.x and `launch` does not turn them on. Call `Bugsee.installNetworkCapture()`, `Bugsee.installLogCapture()` and `Bugsee.installErrorHandlers()`. `print` is recorded only inside a zone that carries the hook, so run startup (the bindings, `launch` and `runApp`) inside `Bugsee.runWithLogCapture` or `Bugsee.runGuarded`. See [Network](/sdk/flutter/network), [Console logs](/sdk/flutter/logs) and [Dart errors](/sdk/flutter/dart-errors). + +
+ +**10. Dart errors are not reported. What do I check?** + +Check `Bugsee.errorHandlersActive`. It is `false` when another tool, for example Crashlytics, replaced the handlers after `installErrorHandlers`: call `installErrorHandlers` after it, so Bugsee chains to it. Also make sure the error happens after launch. A debug build prints a warning at `launch` when the handlers are not current. + +
+ +**11. Why are unhandled Dart errors error reports and not crash reports?** + +`reportAsCrash` defaults to `false`. A Dart error does not end the app, and a crash report counts against crash-free sessions. Pass `reportAsCrash: true` to `installErrorHandlers` to file crash reports, which is what 9.x did for `FlutterError.onError`. + +
+ +**12. Why does my app's `print` output appear twice in an Android report?** + +The SDK's own console capture records the same `print` output again, raw, as source `LogCat` with the tag `flutter`. The Dart log filter does not apply to that echo. If your logs can hold sensitive text, add a native `Bugsee.setLogEventFilter` that drops `LogSource.LogCat` events tagged `flutter`. See [Privacy: logs](/sdk/flutter/privacy/logs). + +
+ +**13. Why do the options I pass to `Bugsee.launch` have no effect on Android?** + +`launch` answered `alreadyRunning`. This happens when the manifest has `com.bugsee.app-token`: the SDK launched itself before Dart, and its options are not replaced. A second `launch` in the same run is also answered `alreadyRunning`. See [Installation](/sdk/flutter/installation). + +
+ +**14. Option values from `getLaunchOptions` show numbers for enums. Is that a bug?** + +No. Enums cross to the SDK by the SDK's own value, so reading options back shows the SDK's internal integers. See [Configuration](/sdk/flutter/configuration). + +
+ +**15. What is deliberately not available in 10.x?** + +The appearance system, APM transactions and spans, `relaunch`, the secure rectangles API, `pause` and `resume` (use blackout), and the test-crash calls. See [Migrating from 9.x to 10.x](/sdk/flutter/migration#6-removed-without-a-replacement). + +## Build problems + +**16. The Android build fails Gradle task validation on `injectBugsee...BuildId`.** + +The Bugsee Gradle plugin is older than 4.1.0. Use 4.1.1. Versions 4.0.x needed an ordering workaround that is no longer needed. + +
+ +**17. No native crashes arrive from Android, and the build is green.** + +Either the `bugsee-android-ndk` artifact is not on the classpath (the plugin declares it: run `./gradlew :app:dependencies | grep bugsee-android-ndk`), or the `detect.crash-ndk` option is off. For readable native frames also turn on the native symbol upload: see [Symbolication: Android](/sdk/flutter/symbolication/android). + +
+ +**18. Extensions such as the feedback chat never register on Android.** + +The Gradle plugin is older than 4.0.7. Version 4.0.6 strips the extension providers and injects nothing. Use 4.1.1. + +
+ +**19. A report recovered after a crash lacks the wrapper identity.** + +The wrapper is registered natively, before the SDK launches, by a content provider of the plugin. Do not add a provider of your own named `BugseeInitProvider`: the Bugsee Gradle plugin deletes it from the APK. + +
+ +**20. `flutter pub get` says the package is "only Swift Package Manager compatible".** + +Flutter is older than 3.50.0 (3.41.0 for the Swift Package Manager check alone). + +
+ +**21. iOS reports a package resolution or deployment target error.** + +Raise the deployment target to 15.0 and run `flutter config --enable-swift-package-manager` where it is not the default. + +
+ +**22. Gradle cannot parse the JDK version.** + +The JDK is newer than the Gradle in use understands. Use JDK 17 or 21. JDK 25 is not in the supported set. + +
+ +**23. The Android report screenshot is black.** + +The Android SDK is older than 7.5.0, which skipped Flutter's default `SurfaceView`. This release uses 7.6.0. + +## Symbolication + +**24. Obfuscated stacks are not readable.** + +Upload the `--split-debug-info` symbols of that exact build. See [Symbolication: Dart](/sdk/flutter/symbolication/dart). + +
+ +**25. Are the Dart and iOS symbols uploaded for me?** + +No. The Android R8 mapping is uploaded by the Gradle plugin, and native symbols after you enable them. The Dart symbols and the iOS dSYMs are manual steps. See [Symbolication overview](/sdk/flutter/symbolication/overview). diff --git a/docs/sdk/flutter/feedback.md b/docs/sdk/flutter/feedback.md index 44b176d8..61c9b259 100644 --- a/docs/sdk/flutter/feedback.md +++ b/docs/sdk/flutter/feedback.md @@ -1,35 +1,118 @@ --- title: "Feedback" -description: "How to show the in-app feedback messenger, receive new message notifications, and set a default greeting in the Bugsee Flutter SDK." -sidebar_position: 6 +description: "Installing and using bugsee_flutter_feedback, the in-app feedback chat for Bugsee Flutter SDK 10.x: showing the chat, the greeting, message streams and errors." +sidebar_position: 17 slug: "/sdk/flutter/feedback" --- -Bugsee implements a built-in single-threaded messenger to allow your users to communicate with your support and developers. +:::warning[Beta] +This page documents Bugsee Flutter SDK **10.x**, which is in beta, is not published on pub.dev yet and can change between betas. The stable release is **9.x**: see the [9.x documentation](/sdk/flutter/v9/installation). Upgrading? See [Migrating from 9.x to 10.x](/sdk/flutter/migration). +::: -## Feedback controller +Bugsee includes an in-app chat where your users write to you from inside the app, with the same session context Bugsee already captures, and you answer from the Bugsee dashboard. In 10.x it is its own package, `bugsee_flutter_feedback`, so apps that never show it do not carry it. It replaces the 9.x `showFeedbackUI`, `setDefaultFeedbackGreeting` and `setNewFeedbackMessagesCallback`. -To start the feedback controller from within your application +On iOS the chat is a SwiftUI screen, on Android a Jetpack Compose activity (Compose, Material 3 and a rich-text editor come with the package). `bugsee_flutter` itself has neither. -```dart -Bugsee.showFeedbackUI(); +## Installation + +The package is a beta and is not on pub.dev yet, so the hosted constraint cannot resolve today. Depend on the repository: give `bugsee_flutter_feedback` a git entry (`path: packages/bugsee_flutter_feedback`, with the same `url` and `ref` as the core, see [Installation](/sdk/flutter/installation)), **and** a `dependency_overrides:` entry for `bugsee_flutter` with the same git source. + +Once the packages are published, add both at the same version and nothing else: + +```yaml +dependencies: + bugsee_flutter: ^10.0.0-beta.1 + bugsee_flutter_feedback: ^10.0.0-beta.1 ``` -## Notifications +The two are released together and pin the same native SDK versions: Android 7.6.0 and iOS 7.1.0. The feedback package accepts a core from the same version up to the next minor, and checks at run time that the core has the same major and minor version. + +Everything [Installation](/sdk/flutter/installation) asks for applies unchanged: Flutter 3.50.0 or newer, the `com.bugsee.android.gradle` Gradle plugin applied in your app, iOS 15.0 or newer and Swift Package Manager for iOS. + +There is nothing to add to the manifest or to `Info.plist`: + +| Platform | What is added | +| --- | --- | +| Android | `com.bugsee:bugsee-android-feedback`, at the same version as the core SDK. Its `FeedbackActivity` and the `INTERNET` permission are merged into your manifest from the AAR. The activity sets its own AppCompat theme, so your app theme does not matter. minSdk 21. | +| iOS | The `BugseeFeedback` product of [`feedback-spm`](https://github.com/bugsee/feedback-spm), pinned to the core SDK's version, through the package's own SwiftPM plugin package. No `Info.plist` keys: the chat sends text only, so it needs no camera, microphone or photo access. | -To receive notifications about new messages arriving from the server, you should provide ```BugseeNewFeedbackMessagesHandler``` delegate callback: +### How the module registers itself + +You do not register anything. The package adds no initialization provider of its own on Android: the feedback AAR declares its own, and with the Bugsee Gradle plugin's default settings the plugin has the SDK register the module instead. If neither happened, the package registers it when the engine attaches. On iOS it registers the module at image load. + +`await BugseeFeedback.isAvailable()` tells you whether the SDK has the module. Use it before offering a "Contact support" button. + +## Showing the chat + +Call the feedback functions after `Bugsee.launch`. On Android, `show()` does nothing before the SDK has launched. On iOS it opens a chat that cannot reach the backend. ```dart -Bugsee.setNewFeedbackMessagesCallback((List messages) { - ... -}); +import 'package:bugsee_flutter/bugsee_flutter.dart'; +import 'package:bugsee_flutter_feedback/bugsee_flutter_feedback.dart'; +import 'package:flutter/widgets.dart'; + +Future main() async { + WidgetsFlutterBinding.ensureInitialized(); + await Bugsee.launch('YOUR_APP_TOKEN'); + + // The text an empty conversation opens with (null clears it). + await BugseeFeedback.setGreeting('How can we help?'); + + runApp(const MyApp()); +} + +// Wherever you offer it, for example a "Contact support" button. +Future onContactSupport() async { + try { + if (await Bugsee.waitUntilLaunched() && await BugseeFeedback.isAvailable()) { + await BugseeFeedback.show(); + } + } on BugseeFeedbackException { + // Hide the button or tell the user to try later. + } +} ``` -## Default greeting +`waitUntilLaunched` also settles a launch that answered `alreadyRunning` or `deferred`, see [Lifecycle](/sdk/flutter/lifecycle). -Default greeting can be set on the server in your application settings. However, for the cases when network is not available, you can -set default greeting on the client as well: +## The API -```dart -Bugsee.setDefaultFeedbackGreeting("Hi! How can we help?"); -``` \ No newline at end of file +| Member | Description | +| --- | --- | +| `BugseeFeedback.show()` | Presents the chat. | +| `BugseeFeedback.setGreeting(String?)` | The text an empty conversation opens with. `null` clears it. | +| `BugseeFeedback.messagesReceived` | `Stream>`: messages from the dashboard, oldest first. | +| `BugseeFeedback.messageSent` | `Stream`: a message the user sent. | +| `BugseeFeedback.isAvailable()` | Whether the SDK has the feedback module. | + +Messages are text only. The native listener is installed while a stream has a listener. + +The streams fire **only while the chat is on screen**, because both SDKs poll the backend only then. They are not a source of unread badges or notifications, and neither SDK has an unread count. + +### User identity + +The chat asks the user for an e-mail address itself. It skips that screen when the identifier you set with [`Bugsee.setUserIdentifier`](/sdk/flutter/user-session-data) contains an `@`. The SDKs have no separate user name or e-mail field. + +### What is not exposed + +The chat's colors (`FeedbackAppearance` on Android, `BugseeTheme` on iOS) are not exposed, like the appearance system of the core package. Neither SDK has an option key for the chat. + +## Errors + +Every error is a `BugseeFeedbackException`, which is a `BugseeException`, with a `reason`: + +| Reason | Meaning | +| --- | --- | +| `notRegistered` | The SDK has no feedback module registered. | +| `incompatibleCore` | The `bugsee_flutter` in the build is not the version this package was released with: a path, git or overridden dependency, or a stale build. | +| `nativeError` | The plugin is not part of the build (a rebuild is missing after adding the package), or the SDK threw. | + +On a platform without a Bugsee SDK (desktop, web) the calls do nothing. + +## Coming from 9.x + +| 9.x | 10.x | +| --- | --- | +| `Bugsee.showFeedbackUI()` | `BugseeFeedback.show()` | +| `Bugsee.setDefaultFeedbackGreeting(greeting)` | `BugseeFeedback.setGreeting(greeting)` | +| `Bugsee.setNewFeedbackMessagesCallback(callback)` | `BugseeFeedback.messagesReceived` and `messageSent` streams | diff --git a/docs/sdk/flutter/installation.mdx b/docs/sdk/flutter/installation.mdx new file mode 100644 index 00000000..eea7c5d7 --- /dev/null +++ b/docs/sdk/flutter/installation.mdx @@ -0,0 +1,207 @@ +--- +title: "Installation" +description: "Installing Bugsee Flutter SDK 10.x: the pubspec entry, the Android Gradle plugin and JDK, iOS Swift Package Manager, and the first launch from Dart." +sidebar_position: 1 +slug: "/sdk/flutter/installation" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +:::warning[Beta] +This page documents Bugsee Flutter SDK **10.x**, which is in beta, is not published on pub.dev yet and can change between betas. The stable release is **9.x**: see the [9.x documentation](/sdk/flutter/v9/installation). Upgrading? See [Migrating from 9.x to 10.x](/sdk/flutter/migration). +::: + +:::caution[Replacing 9.x] +10.x is a rewrite for the 7.x native SDKs with a different API, not an upgrade in place. [Migrating from 9.x to 10.x](/sdk/flutter/migration) lists the API changes. +::: + +## Requirements + +| | | +| --- | --- | +| Flutter / Dart | 3.50.0 or later / 3.14 or later | +| Android | `minSdk` 21; JDK 17 or 21 for the build; the Bugsee Gradle plugin **4.1.1** (mandatory, see [Android](#android)) | +| iOS | 15.0 or later; Swift Package Manager only (no CocoaPods: Bugsee publishes no pod and the plugin has no podspec) | +| Native SDKs | Android 7.6.0, iOS 7.1.0 | +| Not covered | web, desktop (the calls do nothing there), tvOS, visionOS | + +The Flutter floor is 3.50.0: the 10.x line builds on the release that ships Direct Interop, Android Gradle Plugin 9 and `material_ui`. The plugin is also Swift Package Manager only, so `flutter pub get` fails on Linux and Windows before Flutter 3.41.0. + +## Add the package + +The package is a beta and is not on pub.dev yet, so the git dependency is the only one that resolves today. Add `bugsee_flutter` to your `pubspec.yaml`: + +```yaml +dependencies: + bugsee_flutter: + git: + url: https://github.com/bugsee/bugsee-flutter.git + ref: main +``` + +Then run `flutter pub get`. + +Once the package is published, depend on it from pub.dev instead: + +```yaml +dependencies: + bugsee_flutter: ^10.0.0-beta.1 +``` + +The [feedback chat](/sdk/flutter/feedback) is a separate package, `bugsee_flutter_feedback`. While the core is unpublished, it needs its own git entry (`path: packages/bugsee_flutter_feedback`, with the same `url` and `ref`) and a `dependency_overrides:` entry for `bugsee_flutter` with the same git source, because its hosted constraint on the core cannot resolve yet. + +## Android + + + + +1. **Apply the Bugsee Gradle plugin.** It is mandatory for the 7.x SDK, and a Flutter plugin cannot apply it for you, so your app does. In `android/settings.gradle.kts`, next to the other plugins: + + ```kotlin + plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "9.1.1" apply false // Flutter 3.50 requires AGP 9 + id("com.bugsee.android.gradle") version "4.1.1" apply false + } + ``` + + In `android/app/build.gradle.kts`, after the Android and Flutter plugins: + + ```kotlin + plugins { + id("com.android.application") + id("dev.flutter.flutter-gradle-plugin") + id("com.bugsee.android.gradle") + } + ``` + +2. **Turn on the native symbol upload**, in `android/app/build.gradle.kts`: + + ```kotlin + bugsee { + ndk { enabled.set(true) } + } + ``` + + + + +1. **Apply the Bugsee Gradle plugin.** It is mandatory for the 7.x SDK, and a Flutter plugin cannot apply it for you, so your app does. In `android/settings.gradle`, with the other plugins (use the Android Gradle Plugin version your Flutter template declares; Flutter 3.50 requires AGP 9): + + ```groovy + id 'com.bugsee.android.gradle' version '4.1.1' apply false + ``` + + In `android/app/build.gradle`, after the Android and Flutter plugins: + + ```groovy + id 'com.bugsee.android.gradle' + ``` + +2. **Turn on the native symbol upload**, in `android/app/build.gradle`: + + ```groovy + bugsee { + ndk { enabled.set(true) } + } + ``` + + + + +3. **Build with JDK 17 or 21.** Set `JAVA_HOME`, and `org.gradle.java.home` in `gradle.properties` to pin it. JDK 25 is not part of the supported set. An error that Gradle cannot parse the JDK version means the JDK is newer than the Gradle in use understands. + +Use Bugsee Gradle plugin 4.1.1. On an older plugin the build can fail Gradle task validation on `injectBugseeBuildId`, and plugins older than 4.0.7 strip the extension providers, so extensions such as the feedback chat never register. + +About the native symbol upload: the native crash detector is always present (the package depends on the `bugsee-android-ndk` artefact), but a crash in `libflutter.so` or any other `.so` is readable (function and file:line) only when the backend has that build's native symbols. With `ndk.enabled`, the plugin uploads the unstripped libraries of every non-debuggable build, using the app token (see [Symbolication: Android](/sdk/flutter/symbolication/android)). The R8 mapping upload needs no setting. + +The plugin also registers the Flutter wrapper from a content provider that runs before the SDK can launch, and the package ships consumer ProGuard rules. You add nothing for either. Do not add a provider of your own named `BugseeInitProvider`: the Gradle plugin deletes such a provider from the APK. + +:::info[The first seconds of a session are not recorded on Android] +The SDK's startup hold is on: capture is blacked out from process start until the first Flutter frame is up and the secure views have been published, about one second after the frame. Time caps bound the hold (10 seconds after the last engine that attached before a frame, 20 seconds with none, 60 seconds at most). A cap is a safety limit, not a privacy guarantee. See [Privacy: Video](/sdk/flutter/privacy/video). +::: + +Other Bugsee Android modules (`bugsee-android-okhttp`, `-ktor-2`, `-ktor-3`, `-cronet`, `-compose`, `-leak`) are not added: they instrument native UI and HTTP stacks that a Flutter UI and `dart:io` capture do not use. If your app has native code that uses one of them, declare the dependency yourself and the plugin wires it. + +## iOS + +The iOS side is distributed through Swift Package Manager only. Where it is not on by default, run once: + +```sh +flutter config --enable-swift-package-manager +``` + +Raise the app's **iOS deployment target to 15.0**: in Xcode, Runner target, General, Minimum Deployments, or `IPHONEOS_DEPLOYMENT_TARGET = 15.0` in `ios/Runner.xcodeproj`. Older Flutter app templates default to a lower one. No `Info.plist` keys are required. + +## Launch + +Call `Bugsee.launch` early, with the app token from the Bugsee dashboard: + +```dart +import 'package:bugsee_flutter/bugsee_flutter.dart'; +import 'package:flutter/widgets.dart'; + +Future main() async { + WidgetsFlutterBinding.ensureInitialized(); + + final result = await Bugsee.launch( + 'YOUR_APP_TOKEN', + options: const BugseeOptions( + captureVideo: true, + captureLogsLevel: LogLevel.info, + configDuration: 45, + detectHang: true, + reportingDefaultsCrashPriority: ReportSeverity.critical, + ), + ); + // launched, alreadyRunning and deferred are all "not a failure". + + runApp(const MyApp()); +} +``` + +`options` is optional. See [Configuration](/sdk/flutter/configuration) for the option fields. + +`Bugsee.launch` completes when the SDK answers, with a `LaunchResult`: + +| Result | Meaning | +| --- | --- | +| `launched` | Capture started. | +| `alreadyRunning` | The SDK was already launching or launched. Your options were **not applied**. See [Launching twice](#launching-twice-and-auto-init). | +| `deferred` | iOS only: the app is not active yet, so the SDK starts later. | + +A launch that did not happen throws a `BugseeLaunchException` whose `reason` is a `LaunchFailure`: a blank token (`invalidToken`), a stop still in progress (`stopping`), a refusal (`rejected`), an exception on the native side (`nativeError`), or a platform without an SDK (`unsupportedPlatform`). See [Lifecycle & status](/sdk/flutter/lifecycle) for waiting until capture is up. + +Before `launch`, most calls do nothing and nothing is queued. Attributes, the user identifier and blackout work before launch. See [Lifecycle & status](/sdk/flutter/lifecycle#before-launch). + +## Launching twice and auto-init + +- On **Android** the SDK launches itself before any Dart code runs when the manifest declares `com.bugsee.app-token` meta-data. A later `Bugsee.launch` is then `alreadyRunning` and its options are not applied. To launch from Dart, leave the token out of the manifest, or add ``. Lifecycle events from before the first call into the plugin are delivered when it attaches, and the latest status is replayed. +- **iOS** has no auto-init. +- A second `launch` while the SDK is running starts nothing and returns `alreadyRunning`. To change options, call `await Bugsee.stop()` and then `Bugsee.launch` again. +- A launch while a stop is still in progress is refused with `LaunchFailure.stopping`: await `Bugsee.stop()` first. + +## Stop + +```dart +await Bugsee.stop(); // completes when the SDK has stopped +``` + +`stop` completes at once if the SDK was not running. The next `launch` applies the options it is given. + +## Check that it works + +Launch the app and wait until the status is `launched`, then trigger a report, for example with `Bugsee.upload('Test', 'Hello from Flutter')`, and open the dashboard. Reports upload in the background. + +```dart +Bugsee.statusChanges.listen(print); // launching, launched, stopping, stopped +print(await Bugsee.getStatus()); +``` + +## Next steps + +- [Configuration](/sdk/flutter/configuration): the launch options. +- [Lifecycle & status](/sdk/flutter/lifecycle): status, waiting for a launch, lifecycle events. +- [Privacy](/sdk/flutter/privacy/overview): decide what must not be recorded. +- [Symbolication](/sdk/flutter/symbolication/overview): readable stack traces in release builds. diff --git a/docs/sdk/flutter/lifecycle.md b/docs/sdk/flutter/lifecycle.md index 43859fcd..4fbe58a6 100644 --- a/docs/sdk/flutter/lifecycle.md +++ b/docs/sdk/flutter/lifecycle.md @@ -1,39 +1,188 @@ --- -title: "Lifecycle events" -description: "How to subscribe to Bugsee SDK lifecycle events in Flutter, with a reference table of all available event types and their descriptions." -sidebar_position: 9 +title: "Lifecycle & status" +description: "Launching, stopping and waiting for Bugsee Flutter SDK 10.x, reading its status, and subscribing to its lifecycle events." +sidebar_position: 3 slug: "/sdk/flutter/lifecycle" --- -Bugsee SDK silently works within your app, recording everything to assist you in debugging when something unexpected happens. Our SDK is designed as a black box, but there may be cases when you want to be notified about changes/events within Bugsee itself. Lifecycle events are designed exactly for that. Whenever internal state changes or some important event is raised, a lifecycle event is dispatched to the user code. +:::warning[Beta] +This page documents Bugsee Flutter SDK **10.x**, which is in beta, is not published on pub.dev yet and can change between betas. The stable release is **9.x**: see the [9.x documentation](/sdk/flutter/v9/installation). Upgrading? See [Migrating from 9.x to 10.x](/sdk/flutter/migration). +::: -## Implementing callback +You can launch and stop the SDK at runtime, ask for its status at any time, wait for a launch that is still starting, and subscribe to its lifecycle events: status transitions, report assembly and upload, blackouts and crash relaunches. -You should call **Bugsee.setLifecycleCallback** and provide the callback: +## Launch and stop ```dart -void onBugseeLifecycleEvent(BugseeLifecycleEventType e) { - print(e); +import 'package:bugsee_flutter/bugsee_flutter.dart'; + +final result = await Bugsee.launch('YOUR_APP_TOKEN', options: const BugseeOptions()); +await Bugsee.stop(); +``` + +| Method | Completes with | Notes | +| --- | --- | --- | +| `Bugsee.launch(token, {options})` | `LaunchResult` | When the SDK answers, which is not always "capture started". Throws a `BugseeLaunchException` when the SDK did not launch, and an `ArgumentError` for an option that no platform can honour; see [Configuration](/sdk/flutter/configuration). | +| `Bugsee.waitUntilLaunched({timeout})` | `bool` | Waits for a launch that is still starting. | +| `Bugsee.stop()` | `void` | When the SDK has stopped; at once if it was not running. | + +`Bugsee.launch` registers the Flutter wrapper's identity with the SDK first, then launches. Launch before `runApp`, or early in `main`. + +### LaunchResult + +| Value | Meaning | +| --- | --- | +| `launched` | The SDK launched and capture started. | +| `alreadyRunning` | The SDK was already `launching` or `launched`. Nothing changed, and the options you passed were **not applied**. If it is still `launching`, capture has not started yet. | +| `deferred` | iOS only: the app is not active yet, and the SDK starts when it is. Nothing is capturing yet, and your options are kept for that start. | + +`launched`, `alreadyRunning` and `deferred` are all "not a failure". Do not write `if (result != LaunchResult.launched)` as an error check: on iOS, a plain `await Bugsee.launch` before `runApp` can return `deferred`, because the SDK defers every launch made while the app's state is still `background`. + +`alreadyRunning` has two usual causes: Android auto-init (the manifest declares `com.bugsee.app-token`, so the SDK launched before any Dart code) and launching twice from Dart. See [Installation](/sdk/flutter/installation#launching-twice-and-auto-init). To change options, `await Bugsee.stop()` and launch again. + +### LaunchFailure + +A launch that did not happen throws a `BugseeLaunchException`; its `reason` is a `LaunchFailure`: + +| Reason | Meaning | +| --- | --- | +| `invalidToken` | The token is empty or blank. Nothing reached the SDK. | +| `stopping` | A stop is still in progress, and the SDK refuses a launch until it completes: `await Bugsee.stop()` first. | +| `rejected` | The SDK declined without a reason this plugin can read: a token it rejects, no application context, capture that did not start, or a stop that overtook the launch. The SDK's own log has the reason (the `Bugsee` tag on Android, the console on iOS). | +| `nativeError` | The native side threw while launching. | +| `unsupportedPlatform` | The app runs on a platform the plugin has no SDK for (anything but Android and iOS). | + +### Waiting for capture + +`Bugsee.waitUntilLaunched` settles `launched`, `alreadyRunning` and `deferred` launches alike: + +```dart +await Bugsee.launch('YOUR_APP_TOKEN'); +if (await Bugsee.waitUntilLaunched()) { + // Capture is up. } +``` + +It returns `true` as soon as the status is `launched`. It returns `false` when the launch failed (the status went back to `stopped` after `launching`) or nothing happened within `timeout` (30 seconds by default). A deferred launch that never starts, because the app is never active, times out. It never throws for a failed launch. + +## Before launch + +The wrapper queues and gates nothing before `launch`: each call reaches the SDK as it is, and does what that SDK does. Nothing is queued, so events, traces, logs and notifications sent before launch are lost. + +| Call before `launch` | Result | +| --- | --- | +| Attributes (`setAttribute`, `getAttribute`, ...) | Works on both platforms, persisted across launches and stops. | +| `setUserIdentifier`, `getUserIdentifier`, `clearUserIdentifier` | Works on both platforms. | +| `startBlackout`, `endBlackout`, `isBlackout` | Works on both platforms: a blackout requested before launch is held, so capture starts blacked out, and `endBlackout` before launch cancels it. | +| `event`, `trace`, `log`, `notify` | Dropped; nothing throws and nothing is queued. | +| `addBreadcrumb` | The `Future` completes `false` unless the SDK is launching or launched and `captureBreadcrumbs` is on. | +| `upload`, `showReportDialog` | Do nothing. | +| `setReportHandler` | Stored natively and works. | +| `lifecycleEvents` | Events are buffered natively until Dart attaches, then replayed in order. | + +The same applies after `stop`: events, traces, logs, notifications and uploads are dropped. + +:::tip[Install the report handler first] +Call `Bugsee.setReportHandler` **before** `Bugsee.launch`. During launch the SDK recovers reports from the previous run, such as a crash, and a handler registered afterwards misses them. See [Report handler](/sdk/flutter/report-handler). +::: + +If the plugin is not attached to an engine, every call is a `BugseeException` with a "not registered" message, never a crash and never a silent success. On a platform with no SDK (desktop, web) the calls are no-ops that return neutral values, and `launch` is the call that throws. + +## Status + +The SDK has four states, as a `BugseeStatus`: -Bugsee.setLifecycleCallback(onBugseeLifecycleEvent); +| `BugseeStatus` | Meaning | +| --- | --- | +| `stopped` | Not launched, or fully stopped. | +| `launching` | A launch was accepted and the SDK is starting. Capture is not recording yet. | +| `launched` | Fully running: capture is recording. | +| `stopping` | A stop is in progress. A launch now is refused. | + +```dart +final BugseeStatus last = Bugsee.status; // what the SDK last announced +final BugseeStatus now = await Bugsee.getStatus(); // the SDK's own answer +final bool running = await Bugsee.isLaunched(); // status == launched ``` -## Available lifecycle events - -|Name|Description| -|-|-| -|launched|Event is dispatched when Bugsee was successfully launched| -|started|Event is dispatched when Bugsee is started after being stopped| -|stopped|Event is dispatched when Bugsee is stopped| -|resumed|Event is dispatched when video recording is resumed, i.e. when a [blackout](/sdk/flutter/privacy/video/#blackout) is ended| -|paused|Event is dispatched when video recording is paused, i.e. when a [blackout](/sdk/flutter/privacy/video/#blackout) is started| -|relaunchedAfterCrash|Event is dispatched when Bugsee is launched and pending crash report is discovered. That usually means that app was relaunched after crash.| -|beforeReportShown|Event is dispatched before the reporting UI is shown| -|afterReportShown|Event is dispatched when reporting UI is shown| -|beforeReportUploaded|Event is dispatched when report is about to be uploaded to the server| -|afterReportUploaded|Event is dispatched when report was successfully uploaded to the server| -|beforeFeedbackShown|Event is dispatched before the Feedback controller is shown| -|afterFeedbackShown|Event is dispatched after the Feedback controller is shown| -|beforeReportAssembled|Event is dispatched right before bug/error/crash report is about to be assembled| -|afterReportAssembled|Event is dispatched right after bug/error/crash report is assembled| \ No newline at end of file +| Member | Returns | +| --- | --- | +| `Bugsee.status` | The status the SDK last announced to this app, or `stopped` before it announced one. Kept from lifecycle events, so it is not available the instant the app starts: the first call attaches to the SDK, and a launch made natively before that (the Android manifest auto-init) is reported once attached. | +| `Bugsee.getStatus()` | The SDK's current status, read from the SDK. | +| `Bugsee.isLaunched()` | `true` only when the status is `launched`. False while capture is still starting. | +| `Bugsee.statusChanges` | A broadcast `Stream` of every transition. | + +A launch is not live capture until the status is `launched`. After `launch` returns `launched`, capture has started. After `alreadyRunning` or `deferred`, check `getStatus()` or wait with `waitUntilLaunched`. + +### Status changes + +```dart +final subscription = Bugsee.statusChanges.listen((status) { + if (status == BugseeStatus.launched) { + // Capture is up. + } +}); + +// Later +await subscription.cancel(); +``` + +`statusChanges` emits from when a listener subscribes. A transition that happened before the first call into the plugin is delivered when it attaches (the latest status is replayed). Only `launching`, `launched`, `stopping` and `stopped` change the status; no other lifecycle event does. + +## Lifecycle events + +`Bugsee.lifecycleEvents` is a broadcast `Stream` of every event the SDK dispatches: + +```dart +final subscription = Bugsee.lifecycleEvents.listen((event) { + if (event.name == 'RelaunchedAfterCrash') { + // The previous session ended with a crash. + } + if (event.reportId != null) { + print('${event.name}: ${event.reportId}'); + } +}); +``` + +A `LifecycleEvent` has these members: + +| Member | Type | Meaning | +| --- | --- | --- | +| `name` | `String` | The event name, with the `com.bugsee.lifecycle.` prefix already removed, for example `RelaunchedAfterCrash`. | +| `reportId` | `String?` | The id of the report the event is about, for the report events in the table below; `null` for the rest. | +| `data` | `Map` | String-to-string payload entries; usually empty. | + +The events: + +| Event | `reportId` | Description | +| --- | --- | --- | +| `Launching` / `Launched` | no | The SDK is starting / has started. | +| `Stopping` / `Stopped` | no | The SDK is stopping / has stopped. | +| `BlackoutStarted` / `BlackoutEnded` | no | Visual capture paused / resumed by `startBlackout()` / `endBlackout()`. | +| `RelaunchedAfterCrash` | no | The SDK launched and found a crash from the previous session. | +| `BeforeReportShown` / `AfterReportShown` | no | The report UI is about to be shown / has been shown. | +| `BeforeReportAssembled` / `AfterReportAssembled` / `ReportAssemblyFailed` | yes | Report assembly stages. | +| `BeforeReportUploaded` / `AfterReportUploaded` | yes | Report upload start / success. | +| `ReportUploadFailedWithFutureRetry` / `ReportUploadFailed` | yes | Upload failed, to be retried / permanently. | + +The two platforms do not emit exactly the same set of events. + +How events are delivered: + +- `name` is an open string, not an enum. An event this version does not know is delivered unchanged, so a newer native SDK reaches your listener through an older package. Compare `name` against the names you handle and ignore the rest. +- Events arrive on the app's main isolate, in the order the SDK raised them. Native code strips the prefix once and hops to the platform thread before touching Flutter. +- Events reach every attached Flutter engine. +- While no engine is attached, native buffers events (at most 64; the oldest are dropped first) and delivers them when one attaches. The latest status is replayed to each new receiver. The first call into the plugin attaches it. +- Once attached, nothing is buffered for a Dart listener that has not subscribed yet: a stream listener that subscribes late misses what came before. Ask `getStatus()` for the current state rather than rebuilding it from events. +- An event is never proof that a report exists: `RelaunchedAfterCrash` fires whether or not a crash report was produced. + +## Blackout + +`Bugsee.startBlackout()` and `Bugsee.endBlackout()` bracket a window in which everything that describes the screen is suppressed (the video, the report screenshot, touches and the view hierarchy), while logs, network events, custom events and traces keep recording. `Bugsee.isBlackout()` returns the current state. On Android a blackout lasts from launch to `stop`, which ends it. See [Privacy: Video](/sdk/flutter/privacy/video). To shut the SDK down, use `stop()`. + +## Related pages + +- [Installation](/sdk/flutter/installation): the first launch and Android auto-init. +- [Configuration](/sdk/flutter/configuration): the options `launch` takes. +- [Report handler](/sdk/flutter/report-handler): changing reports before they are sent. +- [Privacy: Video](/sdk/flutter/privacy/video): blackout and secure views. diff --git a/docs/sdk/flutter/logs.mdx b/docs/sdk/flutter/logs.mdx new file mode 100644 index 00000000..c19ed5cb --- /dev/null +++ b/docs/sdk/flutter/logs.mdx @@ -0,0 +1,167 @@ +--- +title: "Console logs" +description: "How Bugsee Flutter SDK 10.x records print and debugPrint output: installLogCapture, runWithLogCapture, forwardLog, setLogFilter, log levels and the Android logcat echo." +sidebar_position: 9 +slug: "/sdk/flutter/logs" +--- + +:::warning[Beta] +This page documents Bugsee Flutter SDK **10.x**, which is in beta, is not published on pub.dev yet and can change between betas. The stable release is **9.x**: see the [9.x documentation](/sdk/flutter/v9/installation). Upgrading? See [Migrating from 9.x to 10.x](/sdk/flutter/migration). +::: + +Bugsee attaches the log lines your app wrote before a report to that report, on the same timeline as the video and network events. In a Flutter app those lines come from three places: + +- **What Dart prints**, which the plugin records when you turn on [log capture](#capturing-print-and-debugprint): `print`, `debugPrint` and the lines your own logger forwards. This capture is **opt-in**. +- **The native SDKs' own console capture**: logcat on Android (see [the Android echo](#the-android-logcat-echo)), `stdout` and `stderr` on iOS. +- **Lines you write on purpose** with `Bugsee.log`, which are always recorded and are not filtered. + +Lines the plugin records are attributed to the plugin (log source `Custom`), not to your application. Lines from `Bugsee.log` keep the source `Bugsee`. + +## Capturing print and debugPrint + +`print` needs a zone that carries the plugin's hook, because Dart cannot replace the root zone's `print`. `debugPrint` is a global callback, and the plugin chains to it. Wrap startup in `runWithLogCapture` and install the capture once, early: + +```dart +import 'package:bugsee_flutter/bugsee_flutter.dart'; +import 'package:flutter/widgets.dart'; + +void main() { + // The bindings and runApp share one zone, and it is the one that records print. + Bugsee.runWithLogCapture(() { + WidgetsFlutterBinding.ensureInitialized(); + Bugsee.installLogCapture(); + runApp(const MyApp()); + }); +} + +// Later: Bugsee.launch(...). Lines printed before the SDK is launching or launched are dropped. +``` + +| Member | Description | +| --- | --- | +| `Bugsee.installLogCapture({level})` | Starts the capture. `level` is the level recorded for `print` and `debugPrint` lines, which carry none (default `LogLevel.info`). Returns whether it is in effect. Idempotent. Throws a `BugseeException` from a background isolate. | +| `Bugsee.uninstallLogCapture()` | Stops it and puts `debugPrint` back when it is still the plugin's hook. Lines already queued are still handed to the SDK. | +| `Bugsee.logCaptureInstalled` | Whether the capture is installed. | +| `Bugsee.runWithLogCapture(body)` | Runs `body` in a zone that records `print`. Returns what `body` returns. Errors are not handled; use `Bugsee.runGuarded` for that, which records `print` too. | +| `Bugsee.logCaptureZoneSpecification` | The `ZoneSpecification` with the `print` hook, to build a zone yourself: `runZonedGuarded(body, onError, zoneSpecification: Bugsee.logCaptureZoneSpecification)`. A zone has one `print` handler: to have your own as well, nest the zones. | +| `Bugsee.forwardLog(message, {level, tag})` | Records a line your own logger produced, like `print`. Returns whether the capture took it; never throws. | +| `Bugsee.setLogFilter(filter, {timeout})` | Sets the [filter](#filtering-log-lines). `null` removes it. | +| `Bugsee.logFilter` | The filter that is set, or `null`. | +| `Bugsee.logCaptureStats` | Counters for diagnosis: `LogCaptureStats`. | + +### What is captured + +| Dart output | Captured | +| --- | --- | +| `print` inside a zone with the hook (`runWithLogCapture`, `runGuarded`, or your own zone built from `logCaptureZoneSpecification`) | Yes, tag `print`. | +| `print` in the root zone | **No.** It cannot be hooked in Dart. | +| `debugPrint`, wherever it is called | Yes, tag `debugPrint`. | +| The `FlutterError` diagnostics dump | **Never by this capture**: the dump carries widget trees and property values. Report the error with [`Bugsee.reportException`](/sdk/flutter/manual/crash-error-reporting) or the [installed error handlers](/sdk/flutter/dart-errors) instead. On Android the SDK's logcat capture can still record it; see [the Android echo](#the-android-logcat-echo). | +| The plugin's own `bugsee_flutter:` messages | Never. | +| `dart:developer`'s `log()` | No, and it cannot be hooked. Use `Bugsee.forwardLog` or `Bugsee.log`. | +| `stdout.write`, `stderr.write` | No by this capture. They reach the platform console, where the SDK's own capture may record them. | +| Output of another isolate | No. | +| `package:logging` | Through `Bugsee.forwardLog` (the plugin has no dependency on it). | + +The original output always happens first and unchanged. The plugin never swallows a line, and a hook installed before it keeps working: `uninstallLogCapture` restores `debugPrint` only when the plugin's hook is still the current one, otherwise it stays in the chain and forwards. + +### Your own logger + +`Bugsee.forwardLog` records a line the way `print` is recorded: it goes through the filters, carries the source `Custom` and is subject to the same gates and limits. It is not `Bugsee.log`. + +```dart +import 'package:logging/logging.dart'; + +Logger.root.onRecord.listen((r) => Bugsee.forwardLog( + '${r.loggerName}: ${r.message}', + level: logLevelForLoggingValue(r.level.value), + tag: r.loggerName, +)); +``` + +`logLevelForLoggingValue` maps a `package:logging` `Level.value` to a `LogLevel`: 1000 and above is `error`, 900 and above `warning`, 800 and above `info`, 500 and above `debug`, anything lower `verbose`. The `tag` is recorded on Android only; iOS log events have no tag. + +## Levels and options + +| Option | Default | Effect here | +| --- | --- | --- | +| `captureLogs` | `true` | `false` stops both this capture and the SDK's automatic console capture. Lines from `Bugsee.log` are still recorded. | +| `captureLogsLevel` | `LogLevel.verbose` | Lines more verbose than this level are not sent. The plugin applies it to its own lines on both platforms. | +| `captureLogsAllSources` | `false` | Android only. Reads more logcat sources (system, radio). Concerns the SDK's own capture, not this one. | + +```dart +await Bugsee.launch( + 'YOUR_APP_TOKEN', + options: const BugseeOptions( + captureLogs: true, + captureLogsLevel: LogLevel.info, + ), +); +``` + +The level of `print` and `debugPrint` lines is the `level` you pass to `installLogCapture`. `Bugsee.log(message, {level})` sets its own level and is not affected by `captureLogsLevel`. + +## The Android logcat echo + +On Android the SDK also reads the process's logcat, where the Flutter engine writes every `print` and `debugPrint`. So the same line can be recorded **twice**: once by this capture (source `Custom`) and once by the SDK (source `LogCat`, tag `flutter`). The SDK's copy is raw, and **the Dart filter does not apply to it**. + +```text +source level tag message +3 3 flutter password=hunter2 <- logcat echo, never passed through your Dart filter +98 3 print password= <- this capture, after your Dart filter +``` + +On a real app the echo also carries the `FlutterError` dump. No launch option turns the echo off on its own: `captureLogs` turns off both routes. To redact or drop it, set a log filter on the native SDK in your host app. The native filter runs on every source other than `Bugsee`: + +```kotlin +Bugsee.setLogEventFilter { event, callback -> + when { + // The plugin's own lines (source Custom) were filtered in Dart already. + event.logSource == LogSource.LogCat && event.tag == "flutter" -> callback.run(null) // drop the echo + else -> callback.run(event) + } +} +``` + +See [Android: Privacy: Console logs](/sdk/android/privacy/logs) for the native filter itself. + +iOS recorded no echo on the simulator: only the hooked lines appeared, and a `print` in the root zone was not recorded at all. This was not verified on a physical device or in a release build. A debug build on Android prints a warning once when you set a Dart filter while `captureLogs` is on. + +## Filtering log lines + +`Bugsee.setLogFilter` sets a Dart function that every line this capture records passes through before anything is handed to the SDK. Return the event (changed in place, or a copy) to record it, or `null` to drop it: + +```dart +Bugsee.setLogFilter((event) { + if (event.message.contains('password')) return null; // not recorded + event.message = event.message.replaceAll(RegExp(r'\b\d{16}\b'), ''); + return event; +}); +``` + +The filter receives a `BugseeLogEvent` with a mutable `message`, `level` and `tag`, and a read-only `time`. An empty message drops the line. + +- **It runs in Dart, so lines this capture records cannot skip it.** It sees the line before anything leaves the isolate. +- **It fails closed.** A filter that throws, returns something other than a `BugseeLogEvent` or `null`, or returns a `Future` that does not complete within its timeout drops that line. A debug build prints a warning once, and `logCaptureStats.filterFailures` counts them. After three timeouts in a row the filter is switched off for 30 seconds and its lines are dropped at once (`droppedFilterCoolDown`). +- **The timeout** is the `timeout` argument: 10 seconds by default, which is the SDK's own filter timeout; it must be positive and at most 5 minutes, or `setLogFilter` throws a `BugseeArgumentException`. +- **It runs on the isolate that printed**, one line at a time and in order, never inside the `print` call, and in a zone that records nothing, so a filter that prints cannot loop. Keep it fast. It may return a `Future`. +- **It does not cover `Bugsee.log`** (an app-level log bypasses the filters by design) **or the Android logcat echo** (see above). +- **The native filter runs after it.** If your app set a log filter on the native SDK, it runs on what your Dart filter returned. +- **The SDKs have no default log sanitizer.** Unlike network events, nothing redacts a log line by rule. A line your filter leaves untouched is recorded as it is. See [Privacy: Console logs](/sdk/flutter/privacy/logs). + +## Limits + +- **Before `launch` and after `stop`.** A line printed while the SDK is neither launching nor launched is dropped, not buffered. +- **Length.** A line is cut to 4000 characters, with a truncation marker. +- **Rate.** At most 500 lines a second are taken, with a burst of 1000. The queue holds 1000 lines or 2 MiB. A slow native side drops the newest lines. `logCaptureStats` counts every drop. +- **Timestamps.** A line keeps the time it was printed, even when a slow filter or a long queue delayed it. +- **Before a report.** Before an upload, `createReport`, the report dialog and every error report, pending lines are handed to the SDK first, waiting at most 200 ms, so `print('parsing $x'); throw ...` puts the line in the report. A crash the SDK catches itself cannot wait. +- **Isolates.** Output of another isolate is not captured, and `installLogCapture` throws a `BugseeException` from a background isolate. Send those lines to the root isolate and call `forwardLog` there. +- **Hot restart.** The hooks, queue and policy belong to the isolate. The new isolate's `main` installs the capture again. +- **`submittedToSdk` is not "recorded".** The SDK can still drop a line silently, for example when a native filter never replies. + +## Related pages + +- [Privacy: Console logs](/sdk/flutter/privacy/logs): redaction, the missing sanitizer and the Android echo in one place. +- [Events and traces](/sdk/flutter/events-and-traces): `Bugsee.log` and the other lines you write on purpose. +- [Configuration](/sdk/flutter/configuration): the full option list. diff --git a/docs/sdk/flutter/manual/bug-reporting.md b/docs/sdk/flutter/manual/bug-reporting.md new file mode 100644 index 00000000..6c9edfaa --- /dev/null +++ b/docs/sdk/flutter/manual/bug-reporting.md @@ -0,0 +1,148 @@ +--- +title: "Bug reporting" +description: "Let users and your code file bug reports with Bugsee Flutter SDK 10.x: the built-in triggers, the report dialog, silent upload, and building a report with createReport." +sidebar_position: 4 +slug: "/sdk/flutter/manual/bug-reporting" +--- + +:::warning[Beta] +This page documents Bugsee Flutter SDK **10.x**, which is in beta, is not published on pub.dev yet and can change between betas. The stable release is **9.x**: see the [9.x documentation](/sdk/flutter/v9/installation). Upgrading? See [Migrating from 9.x to 10.x](/sdk/flutter/migration). +::: + +Bug reports cover something that is wrong but did not crash the app. Your users can raise one with a gesture, or you can open the report dialog, or submit a report silently, from your own code. Handled and unhandled Dart errors are covered separately, in [Crash & error reporting](/sdk/flutter/manual/crash-error-reporting). + +The calls on this page need a launched SDK; see [Before launch](#before-launch). The snippets assume `import 'package:bugsee_flutter/bugsee_flutter.dart';`. + +## Built-in report triggers + +The native SDKs can open the report dialog on their own, without any call from your code. The triggers are launch options on `BugseeOptions`, all off by default: + +| Field | Option key | Platforms | Default | Opens the report dialog when | +| --- | --- | --- | --- | --- | +| `reportingTriggersShake` | `com.bugsee.option.reporting.triggers.shake` | both | `false` | The user shakes the device. | +| `reportingTriggersScreenshot` | `com.bugsee.option.reporting.triggers.screenshot` | both | `false` | The user takes a screenshot. | +| `reportingTriggersNotificationBar` | `com.bugsee.option.reporting.triggers.notification-bar` | Android | `false` | The user taps the Bugsee entry in the notification bar. | +| `reportingTriggersBroadcast` | `com.bugsee.option.reporting.triggers.broadcast` | Android | `false` | An Android broadcast intent asks for a report. | + +An option that exists on one platform only is ignored on the other, with a warning in debug builds. See [Configuration](/sdk/flutter/configuration) for how options are passed and validated. + +```dart +await Bugsee.launch( + '', + options: const BugseeOptions( + reportingTriggersShake: true, + reportingTriggersScreenshot: true, + ), +); +``` + +The options that shape the dialog itself are `reportingUiSummaryRequired`, `reportingUiDescriptionRequired`, `reportingUiEmailRequired`, `reportingUiLabelsEnabled`, `reportingUiLabelsRequired` and `reportingUiPrioritySelectorEnabled` (all `false` by default), plus `reportingUiStyle` (iOS only). The priority a report gets when nobody picks one comes from `reportingDefaultsBugPriority`, `reportingDefaultsCrashPriority` and `reportingDefaultsErrorPriority`. + +## Show the report dialog + +`Bugsee.showReportDialog` opens the standard reporting UI. Every argument is optional and only pre-fills the form: the user can still edit the values before sending. + +```dart +// An empty form +await Bugsee.showReportDialog(); + +// Pre-fill the summary and description +await Bugsee.showReportDialog( + summary: 'Checkout is frozen', + description: 'The spinner never stops.', +); + +// Pre-fill everything +await Bugsee.showReportDialog( + summary: 'Checkout is frozen', + description: 'The spinner never stops.', + severity: ReportSeverity.high, + labels: ['checkout'], +); +``` + +| Argument | Type | When omitted | +| --- | --- | --- | +| `summary` | `String?` | The field is left empty. | +| `description` | `String?` | The field is left empty. | +| `severity` | `ReportSeverity?` | The SDK's default bug priority. | +| `labels` | `List?` | No labels are pre-filled. | + +`ReportSeverity` has the values `veryLow`, `medium`, `high`, `critical` and `blocker` (`ReportSeverity.low` is the iOS name for `veryLow`). + +The returned `Future` completes with nothing: it does not tell you whether the user sent the report or dismissed the dialog. To follow it, listen to [`Bugsee.lifecycleEvents`](/sdk/flutter/lifecycle). The call is a no-op while a dialog is already showing. The dialog runs your [report handler](/sdk/flutter/report-handler)'s `onBeforeReportCreated` before it opens. + +## Silent upload + +`Bugsee.upload(summary, description, {severity, labels})` creates and uploads a bug report at once, without UI, from what the SDK has captured. Summary and description are required. + +```dart +await Bugsee.upload( + 'Sync failed', + 'The background sync gave up after three retries.', + severity: ReportSeverity.high, + labels: ['sync'], +); +``` + +Without a `severity` the SDK applies its default bug priority. To edit a report as it is created (labels, attributes, attachments), use a [report handler](/sdk/flutter/report-handler). + +## Build a report yourself + +`Bugsee.createReport` hands you a report object to fill in, and sends it only when you call `upload()`. Use it when the content is assembled over time or after an async step. + +```dart +final report = await Bugsee.createReport(); +if (report != null) { + await report.setSummary('Checkout failed'); + await report.setSeverity(ReportSeverity.high); + await report.replaceLabels(['checkout']); + await report.setAttribute('cart-size', 3); + await report.addAttachment(logFile.path, name: 'checkout-log', mimeType: 'text/plain'); + await report.upload(); +} +``` + +`createReport({Duration timeToLive = const Duration(minutes: 10)})` completes with `null` when the SDK did not hand a report back. Call it after `launch`. A `CreatedReport` offers: + +| Member | Notes | +| --- | --- | +| `read()` | A `CreatedReportSnapshot` of the report now (a value, not live). | +| `setSummary`, `setDescription`, `setSeverity` | Set the fields. | +| `replaceLabels` | Replaces all labels. | +| `setAttribute`, `removeAttribute`, `clearAttributes` | Attributes of this report only; same value types as [attributes](/sdk/flutter/user-session-data#attributes). | +| `addAttachment(path, {name, mimeType})` | Copies the file. | +| `addAttachmentBytes(bytes, {name, mimeType})` | 1 byte to 1 MiB. | +| `clearAttachments`, `setScreenshot(path, {annotated})` | Attachments and the screenshot. | +| `upload()` | Hands the report to the SDK. Completes with `false` if the SDK declined. | +| `discard()` | Releases the report without sending it. | +| `isLive` | `false` once uploaded, discarded or expired. | + +Rules to know: + +- **One at a time, process-wide.** A second `createReport` while one is outstanding throws `CreateReportException` with reason `busy`. At most 6 can be started a minute (`rateLimited`). +- **Time to live.** An unfinished report is discarded after `timeToLive` (between one second and one hour). Every later call on it throws `CreatedReportClosedError`. +- **Deadlines.** The SDK has 45 seconds to answer `createReport` (`timeout`) and 45 seconds to answer `upload()`. On `uploadTimeout` the report may still be sent: do not upload it again. +- **No cancel.** The SDKs cannot cancel a created report. A discarded or expired one is never sent, but the SDK keeps its opened snapshot on disk until the next launch, which is why the rate limit exists. +- **Your report handler runs for it too.** On Android `onBeforeReportCreated` runs inside `createReport()` and `onAfterReportCreated` at `upload()`. On iOS both run at `upload()`, after your fields are applied, so a handler's `replaceLabels` replaces the labels you set. + +### Android and iOS differ + +| | Android | iOS | +| --- | --- | --- | +| Report id | `reportId` is set. | `reportId` is `null`. | +| Attachments | Copied into the report's storage at once. | Held in memory until `upload()`: at most 3, each 1 byte to 3 MiB, and no `mimeType` is kept. | +| Screenshot | Any display; `annotated` is supported. | One screenshot; `annotated: true` is refused with `ReportAttachmentFailure.unsupported`. | + +File and screenshot limits (path rules, 20 MiB per file, 4096 x 4096 pixels) and the `ReportAttachmentException` reasons are shared with the report handler; see [Attachments and screenshots](/sdk/flutter/report-handler#attachments-and-screenshots). + +## Before launch + +The wrapper queues nothing before `launch`: each call does what the native SDK does. + +| Call | Before `launch` | +| --- | --- | +| `showReportDialog` | No-op (on iOS it needs the launched state, not `launching`). | +| `upload` | No-op. | + +Neither SDK throws for these; the call is dropped. Call `createReport` after `launch` too. diff --git a/docs/sdk/flutter/manual/crash-error-reporting.md b/docs/sdk/flutter/manual/crash-error-reporting.md new file mode 100644 index 00000000..64492ae7 --- /dev/null +++ b/docs/sdk/flutter/manual/crash-error-reporting.md @@ -0,0 +1,69 @@ +--- +title: "Crash & error reporting" +description: "Report Dart errors with Bugsee Flutter SDK 10.x: logException, logUnhandledException and reportException, error versus crash reports, and what a Dart error report contains." +sidebar_position: 5 +slug: "/sdk/flutter/manual/crash-error-reporting" +--- + +:::warning[Beta] +This page documents Bugsee Flutter SDK **10.x**, which is in beta, is not published on pub.dev yet and can change between betas. The stable release is **9.x**: see the [9.x documentation](/sdk/flutter/v9/installation). Upgrading? See [Migrating from 9.x to 10.x](/sdk/flutter/migration). +::: + +Bugsee detects native crashes on its own (see [Overview](/sdk/flutter/overview)). A Dart error is different: it never ends the app, so nothing crashes and nothing is reported unless you say so. This page covers the calls you make yourself. To report the errors nobody handled, without wrapping every call, see [Dart errors](/sdk/flutter/dart-errors). + +The snippets assume `import 'package:bugsee_flutter/bugsee_flutter.dart';`. + +## Report a caught error + +```dart +try { + await syncOrders(); +} catch (error, stack) { + await Bugsee.logException(error, stack); // an error report + await Bugsee.logUnhandledException(error, stack); // a crash report + await Bugsee.reportException(error, stackTrace: stack, domain: 'sync'); // an error report with a grouping domain +} +``` + +In practice you pick one. All three return `Future`: `true` when the SDK was handed the error. + +| Call | Report type | Notes | +| --- | --- | --- | +| `Bugsee.logException(error, [stackTrace])` | Error | The usual call for an error you caught and handled. | +| `Bugsee.logUnhandledException(error, [stackTrace])` | Crash | For an error you caught at the top of something yourself and treat as fatal to the operation. | +| `Bugsee.reportException(error, {stackTrace, handled = true, domain})` | Error, or crash with `handled: false` | The one with options. `domain` is 1 to 256 characters; issues of one domain group together on the dashboard. On iOS the domain is dropped when `handled` is `false`. | + +Any object can be thrown in Dart, so `error` is an `Object`. Without a `stackTrace` the stack at the call is used, starting where you called. A bad `domain` is a `BugseeArgumentException`. + +There is no severity argument: neither native SDK takes one for an exception. Set it in a [report handler](/sdk/flutter/report-handler) with `setSeverity`, which runs for error and crash reports. For the default priorities see `reportingDefaultsErrorPriority` and `reportingDefaultsCrashPriority` in [Configuration](/sdk/flutter/configuration). + +## Error or crash + +| | Error report | Crash report | +| --- | --- | --- | +| Raised by | `logException`, `reportException` (default), the installed handlers (default) | `logUnhandledException`, `reportException(handled: false)`, the installed handlers with `reportAsCrash: true` | +| Counts against crash-free sessions | No | Yes | +| Android | Built in the background and sent with the session. | Written on the plugin's own thread, which snapshots the capture buffer ("up to a couple of seconds"). | +| iOS | Sent with the session. | Stored on disk and sent at the **next launch**, one at a time: each new one replaces the single stored crash report. | + +Prefer error reports. A Dart error does not terminate the app on either SDK, so filing it as a crash would inflate your crash numbers, and on iOS ten crash reports in a minute would still deliver only the last. That is why `reportAsCrash` defaults to `false` (the 9.x plugin reported `FlutterError.onError` as unhandled; pass `reportAsCrash: true` to [`installErrorHandlers`](/sdk/flutter/dart-errors#error-or-crash-reports) to get that back). + +## What the report contains + +The issue shows the Dart exception type, its message and its Dart stack frames, with app frames marked apart from Flutter and `dart:` frames. Reports are grouped by the exception type, the first line of the message (with what varies between runs removed: addresses, UUIDs, long numbers) and the top five app frames, so one error on two days is one issue and different errors are different issues. The application version is not part of the grouping: the same error in two app versions is one issue. + +- A `FlutterError` contributes its **summary** only. The framework's long diagnostic text (widget descriptions, property dumps) is not sent. +- Any other object contributes its type and `toString()`. That is whatever your app put in the error message. The SDK's [privacy filters](/sdk/flutter/privacy/overview) do not apply to exception text, so keep secrets out of error messages. +- File paths of the machine that built the app are reduced to the file name. +- In a build with `--obfuscate` or `--split-debug-info` the stack is sent exactly as the VM printed it and Bugsee turns it into readable frames from the symbols you upload. See [Dart symbolication](/sdk/flutter/symbolication/dart). + +## Before launch and after stop + +Both SDKs drop an error reported before `launch` or after `stop`, and nothing is queued. The wrapper applies the same gate to both paths on both platforms, so the answer `false` means the error was not handed over. Nothing is reported while the last launch made through `Bugsee.launch` had `detect.crash` set to `false`; that gate applies to the [installed handlers](/sdk/flutter/dart-errors), and a launch made natively (Android manifest auto-init) is not seen by it. + +## Limits + +- The iOS Simulator files nothing for a logged or unhandled Dart error. Test on a device. +- An iOS crash report from `logUnhandledException` arrives at the next launch, not at once. Verification of this path on an iOS device is not part of the repo's recorded evidence, so treat it as expected behavior rather than measured. +- On Android the call runs on a bounded queue of 32. A full queue drops the call and answers `false`. Explicit `logException` calls are not rate limited, so do not call it in a tight loop. +- Argument and attach failures throw a `BugseeException` subclass through the returned `Future`; never because of the error you pass. diff --git a/docs/sdk/flutter/migration.mdx b/docs/sdk/flutter/migration.mdx new file mode 100644 index 00000000..8964c356 --- /dev/null +++ b/docs/sdk/flutter/migration.mdx @@ -0,0 +1,240 @@ +--- +title: "Migrating from 9.x to 10.x" +description: "Step-by-step guide for moving a Flutter app from bugsee_flutter 9.x to 10.x: requirements, platform setup, renamed and removed APIs, launch options, capture that is now opt-in, and a checklist." +sidebar_position: 25 +slug: "/sdk/flutter/migration" +--- + +:::warning[Beta] +This page documents Bugsee Flutter SDK **10.x**, which is in beta, is not published on pub.dev yet and can change between betas. The stable release is **9.x**: see the [9.x documentation](/sdk/flutter/v9/installation). Upgrading? See [Migrating from 9.x to 10.x](/sdk/flutter/migration). +::: + +This guide walks through every public-API change between `bugsee_flutter` 9.x (which wraps the 6.x native SDKs) and 10.x, version 10.0.0-beta.1 (which wraps the 7.x native SDKs: Android 7.6.0, iOS 7.1.0). If you are setting up a new project, start from [Installation](/sdk/flutter/installation) instead. + +:::note[TL;DR] +10.x is a rewrite and a clean break, not an in-place upgrade. The package name and the `Bugsee` facade stay, but the launch call, the options, the data calls, the exceptions, the lifecycle events, the report handler and the build setup all change, and `dart:io` network, `print` and Dart error capture are now opt-in. Expect code changes in every file that touches Bugsee. There is **no 9.x compatibility layer**: whether one will be offered is undecided and nothing here promises it. If you cannot change your code, stay on 9.x. +::: + +The package is in beta and not published on pub.dev yet, so you cannot try it with a plain version constraint. [Installation](/sdk/flutter/installation) shows the git dependency. + +--- + +## 1. Requirements + +| | 9.x | 10.x | +| --- | --- | --- | +| Flutter / Dart | 3.0.0 or newer / 3.0 or newer | **Flutter 3.50.0 or newer / Dart 3.14 or newer** | +| Native SDKs | Android 6.x, iOS 6.x | Android **7.6.0**, iOS **7.1.0** | +| Android | `minSdk` 21 | `minSdk` 21. The **Bugsee Gradle plugin 4.1.1 is mandatory** and applied by the app. JDK 17 or 21. | +| iOS | CocoaPods podspec (and a Swift Package Manager package), deployment target 11.0 | **Swift Package Manager only: no podspec, no CocoaPods.** Deployment target **15.0**. | +| Import | `package:bugsee_flutter/bugsee_flutter.dart` (also `bugsee.dart`) | `package:bugsee_flutter/bugsee_flutter.dart` only | +| Feedback chat | Part of the plugin | The separate package [`bugsee_flutter_feedback`](/sdk/flutter/feedback) | + +## 2. Platform setup changes + +| Area | 9.x | 10.x | +| --- | --- | --- | +| Android Gradle plugin | Not needed | The app applies `com.bugsee.android.gradle` 4.1.1. A Flutter plugin cannot apply it for you. | +| Android launch | From Dart | From Dart, or by the SDK itself before Dart when the manifest has `com.bugsee.app-token`. Then `Bugsee.launch` answers `alreadyRunning` and its options are not applied. | +| Android startup | Recording starts at launch | The SDK holds capture from process start until the first Flutter frame and the secure rectangles are ready, about 1 second after it. The first seconds of a session are not recorded. | +| Android native symbols | Configured as in the native docs | Opt in with `bugsee { ndk { enabled.set(true) } }`. See [Symbolication: Android](/sdk/flutter/symbolication/android). | +| iOS | CocoaPods | Swift Package Manager. Run `flutter config --enable-swift-package-manager` where it is not the default, and raise the deployment target to 15.0. | +| Wrapper registration | In the SDK options (`wrapper_info`) | Natively, before the SDK launches. Not something your app does. Do not add an Android provider of your own named `BugseeInitProvider`: the Gradle plugin deletes it. | + +## 3. What changed in the model + +- **Options are one typed class.** `AndroidLaunchOptions` and `IOSLaunchOptions` are replaced by one `BugseeOptions` with a typed field per 7.x option, shared by both platforms. A field you leave out keeps the SDK's default: 9.x wrote its own defaults into every launch. See [Configuration](/sdk/flutter/configuration). +- **Launch returns a result.** `Bugsee.launch` returns a `LaunchResult` (`launched`, `alreadyRunning`, `deferred`) and throws `BugseeLaunchException` on failure. `appRunCallback` is gone: `await` the launch, then call `runApp`. +- **Calls are stricter.** An invalid argument is a `BugseeException` (`BugseeArgumentException`) through the `Future` of the call. The synchronous filter setup calls (`setNetworkFilter`, `setLogFilter`) throw at once on an invalid `timeout`. A bad `BugseeOptions` is an `ArgumentError` from `launch`. 9.x passed most of these on silently. +- **Nothing is queued before launch.** As in 9.x, `event`, `trace`, `log`, `notify` and `upload` before `launch` are dropped. Attributes, the user identifier and blackout work before launch. +- **Capture is opt-in** for what only Dart can see: `installNetworkCapture`, `installLogCapture` and `installErrorHandlers`. 9.x installed its global error handler inside `launch` and captured `print` only inside an `appRunCallback` zone. +- **The report handler is first-class.** `setReportHandler` replaces the 9.x attachments callback. See [Report handler](/sdk/flutter/report-handler). + +## 4. API mapping + +`Bugsee.` is the facade class in both versions. "Same" means the same name and meaning; a different signature is noted. + +### 4.1 Execution + +| 9.x | 10.x | +| --- | --- | +| `launch(token, {appRunCallback, launchOptions})` returning `Future` | `launch(token, {options})` returning `Future`. `appRunCallback` is **removed**: `await` the launch, then `runApp` (use `Bugsee.runGuarded` for the zone). | +| `stop()` | Same | +| `relaunch([options])` | **Removed**: `await Bugsee.stop()`, then `Bugsee.launch(...)` | +| `pause()` / `resume()` | **Removed**: `startBlackout()` / `endBlackout()`. Blackout stops video, screenshot, touches and the view hierarchy. Logs and data continue. | +| (none) | `status`, `statusChanges`, `getStatus()`, `isLaunched()`, `waitUntilLaunched()`, `getLaunchOptions()`, `getHostLaunchOptions()`, `isBlackout()`. See [Lifecycle](/sdk/flutter/lifecycle). | +| `defaultHttpOverrides` | **Removed**: `installNetworkCapture()`, which chains to `HttpOverrides.current` | +| `setApplicationVersion(version)` | **Removed**: the SDKs read the app version natively | +| `testExceptionCrash()`, `testSignalCrash()` | **Removed** | + +```dart +// 9.x +await Bugsee.launch(token, appRunCallback: (launched) => runApp(const MyApp()), + launchOptions: AndroidLaunchOptions()..maxRecordingTime = 45); + +// 10.x +await Bugsee.launch(token, options: const BugseeOptions(configDuration: 45)); +runApp(const MyApp()); +``` + +### 4.2 Data + +| 9.x | 10.x | +| --- | --- | +| `setAttribute(String, dynamic)`, `getAttribute`, `clearAttribute`, `clearAllAttributes` | Same names. The value is a `String`, `bool`, `int` or finite `double`: anything else is a `BugseeArgumentException`. New `getAllAttributes()`. A value an SDK drops for size is a `BugseeAttributeException`. | +| `setEmail` / `getEmail` / `clearEmail` | `setUserIdentifier` / `getUserIdentifier` / `clearUserIdentifier`. One identifier: the SDKs have no separate e-mail field, and an e-mail-shaped value links reports to a user. | +| `event(name, [Map])` | `event(name, [Map])`, validated: JSON-like values, 16 levels deep | +| `trace(name, dynamic)` | `trace(name, Object)`: a `String`, `bool`, `int` or finite `double` | +| `log(text, [BugseeLogLevel])` | `log(message, {LogLevel level = LogLevel.info})` | +| `captureViewHierarchy()` | Same | +| (none) | `addBreadcrumb(BugseeBreadcrumb)`, `notify(title, ...)`. See [Events and traces](/sdk/flutter/events-and-traces). | +| `BugseeLogLevel` (`invalid`, `error`, `warning`, `info`, `debug`, `verbose`) | `LogLevel` (`error`, `warning`, `info`, `debug`, `verbose`): no `invalid` | + +```dart +// 9.x +await Bugsee.setEmail('user@example.com'); + +// 10.x +await Bugsee.setUserIdentifier('user@example.com'); +``` + +See [User and session data](/sdk/flutter/user-session-data). + +### 4.3 Exceptions + +| 9.x | 10.x | +| --- | --- | +| `logHandledException(e, [stack])`, `logException(e, [stack])` (an alias) | `logException(error, [stackTrace])`: an error report. It answers whether the SDK was handed it. | +| `logUnhandledException(e, [stack])` | Same name: a crash report | +| The global handler installed by `launch` | Opt-in `installErrorHandlers({reportAsCrash = false})`. **Error reports by default.** 9.x reported `FlutterError.onError` as unhandled: pass `reportAsCrash: true` to restore that. | +| `runGuarded(body, errorCallback)` (callback required, positional) | `runGuarded(body, {onError})` (named, optional) | +| `captureChain(body)` | **Removed** | +| `BugseeIsolate`, `addBugseeErrorListener()` / `removeBugseeErrorListener()` | `Bugsee.listenToIsolateErrors(isolate)`, which returns an `IsolateErrorListener` with `cancel()` | +| (none) | `reportException(error, {stackTrace, handled, domain})`, `errorHandlersInstalled`, `errorHandlersActive` | + +The exception document sent to the backend changed with the SDKs: it now carries a `signature`, and the signature no longer hashes the application version, so the same error in two app versions is one issue. See [Crash and error reporting](/sdk/flutter/manual/crash-error-reporting) and [Dart errors](/sdk/flutter/dart-errors). + +### 4.4 Network and logs + +| 9.x | 10.x | +| --- | --- | +| `HttpOverrides.global = Bugsee.defaultHttpOverrides` | `Bugsee.installNetworkCapture()`, which chains to any overrides you set first | +| `setNetworkFilter(Future Function(BugseeNetworkEvent))`. The event had `type`, `method`, `url`, `redirectUrl`, `body`, `headers`. | `setNetworkFilter(filter, {timeout})`. The event has `id`, `stage`, `method`, `url`, `headers`, `body`, `statusCode`, `redirectedFrom` and more. A filter that throws or hangs **drops** the event. | +| `registerNetworkEvent(eventData)` | **Removed**: capture is automatic once installed | +| `setLogFilter(Future Function(BugseeLogEvent))`. The event had `text`, `level`. | `setLogFilter(filter, {timeout})`. The event has `message`, `level`, `tag`. It applies to `print`, `debugPrint` and `forwardLog`, not to `Bugsee.log`. | +| `print` captured when `launch` was given an `appRunCallback` zone | Opt-in `installLogCapture()` plus `runWithLogCapture` or `runGuarded` | +| (none) | `forwardLog`, `logCaptureStats`, `networkCaptureStats` | + +```dart +// 9.x +HttpOverrides.global = Bugsee.defaultHttpOverrides; +Bugsee.setNetworkFilter((e) async { e.headers?.remove('authorization'); return e; }); + +// 10.x +Bugsee.installNetworkCapture(); +Bugsee.setNetworkFilter((e) { e.headers.remove('authorization'); return e; }); +``` + +See [Network capture](/sdk/flutter/network) and [Console logs](/sdk/flutter/logs). + +### 4.5 Reports, attachments, lifecycle + +| 9.x | 10.x | +| --- | --- | +| `upload([summary, description, severity, labels])`, all optional and positional | `upload(summary, description, {severity, labels})`: summary and description are required | +| `showReportDialog([summary, description, severity, labels])` | `showReportDialog({summary, description, severity, labels})`, all named | +| `BugseeSeverityLevel` (`low`, `medium`, `high`, `critical`, `blocker`) | `ReportSeverity` (`veryLow` with the alias `low`, `medium`, `high`, `critical`, `blocker`): the same values 1 to 5 | +| `BugseeIssueType` | `ReportType` (`bug`, `crash`, `error`) | +| `setAttachmentsCallback(BugseeAttachmentsCallback)` with `BugseeAttachment(name, filename, data)` | **Removed**: `setReportHandler(BugseeReportHandler(...))`, then `ReportProxy.addAttachment(path, ...)` or `addAttachmentBytes(bytes, ...)` | +| (none) | `createReport()`, and `ReportProxy` edits (summary, description, e-mail, severity, labels, attributes, screenshot) | +| `setLifecycleCallback(void Function(BugseeLifecycleEventType))` | `lifecycleEvents`, a `Stream` (`name` is the SDK's event name, `reportId` where the event carries one). Status changes are `statusChanges`. The 9.x members `resumed` and `paused` have no 7.x event. | + +See [Bug reporting](/sdk/flutter/manual/bug-reporting), [Report handler](/sdk/flutter/report-handler) and [Lifecycle](/sdk/flutter/lifecycle). + +### 4.6 Privacy + +| 9.x | 10.x | +| --- | --- | +| `BugseeSecureView(child:, enabled:)` | `BugseeSecureView(child:, enabled:)`, now a regular widget where `child` is required. It is tracked natively, with the limits in [Privacy: video](/sdk/flutter/privacy/video). | +| `BugseeIgnoreSecureView` | **Removed** | +| `addSecureRect`, `removeSecureRect`, `removeAllSecureRects`, `getAllSecureRects` | **Removed**: use `BugseeSecureView`. Native-unit rectangles are not exposed. | + +### 4.7 Feedback + +| 9.x | 10.x (`package:bugsee_flutter_feedback`) | +| --- | --- | +| `showFeedbackUI()` | `BugseeFeedback.show()` | +| `setDefaultFeedbackGreeting(greeting)` | `BugseeFeedback.setGreeting(greeting)` | +| `setNewFeedbackMessagesCallback(callback)` | `BugseeFeedback.messagesReceived` and `messageSent` streams. They fire only while the chat is on screen. | + +See [Feedback](/sdk/flutter/feedback). + +### 4.8 Options + +The mapping is by meaning: the 9.x names against the 10.x field documentation. `BugseeOptions` has a typed field per option the SDKs register, with the option key, the SDK default and the platforms it applies to in its documentation (defaults differ between platforms). An option that exists on one platform only is ignored on the other, with a debug warning. + +| 9.x (`BugseeLaunchOptions`) | 10.x (`BugseeOptions`) | +| --- | --- | +| `maxRecordingTime` | `configDuration` | +| `shakeToReport` | `reportingTriggersShake`. **Off by default since Android 7.6.0 and iOS 7.1.0**: pass `true` to keep shake-to-report. | +| `crashReport` | `detectCrash` | +| `ndkCrashReport` (Android) | `detectCrashNdk` | +| `videoEnabled` | `captureVideo` | +| `videoScale` | `captureVideoScale` | +| `captureLogs` | `captureLogs`, plus `captureLogsLevel` | +| `monitorNetwork` | `captureNetwork` | +| `screenshotEnabled` | `captureScreenshot` | +| `maxDataSize` | `configMaxDataSize` | +| `reportPrioritySelector` | `reportingUiPrioritySelectorEnabled` | +| `defaultCrashPriority` / `defaultBugPriority` | `reportingDefaultsCrashPriority` / `reportingDefaultsBugPriority` (a `ReportSeverity`) | +| `frameRate` (`BugseeFrameRate`) | `captureVideoFrameRate` (`FrameRate`: `low`, `medium`, `high`, and `raw` on Android only) | +| `wifiOnlyUpload` | `configWifiOnlyUpload` | +| `maxNetworkBodySize` | `captureNetworkBodySizeLimit` | +| `captureDeviceAndNetworkNames` | `captureDeviceNetworkNames` | +| `viewHierarchyEnabled` | `captureViewHierarchy` | +| `reportSummaryRequired`, `reportDescriptionRequired`, `reportEmailRequired` | `reportingUiSummaryRequired`, `reportingUiDescriptionRequired`, `reportingUiEmailRequired` | +| `reportLabelsEnabled` / `reportLabelsRequired` | `reportingUiLabelsEnabled` / `reportingUiLabelsRequired` | +| iOS `style` (`BugseeIosVisualStyle`) | `reportingUiStyle` (`BugseeStyle`: `light`, `dusk`, `basedOnStatusBar`, `system`: different members) | +| iOS `monitorDiskSpace`, `monitorBluetoothStatus`, `captureAVPlayer` | `captureDiskSpace`, `captureBluetoothStatus`, `captureAvPlayer` | +| Android `videoMode` / `videoQuality` | `captureVideoMode` (`VideoMode`) / `captureVideoQuality` (`VideoQuality`) | +| Android `notificationBarTrigger` | `reportingTriggersNotificationBar`. **Off by default since Android 7.6.0**: pass `true` to keep the report notification. | +| iOS `screenshotToReport` | `reportingTriggersScreenshot`. **Off by default in 10.x** (`screenshotToReport` was on by default in 9.x): pass `true` to keep reporting when the user takes a screenshot. | +| iOS `killDetection`; Android `serviceMode` | No one-to-one typed field verified. Search `BugseeOptions` for the 7.x option, or pass it in `BugseeOptions.custom`. | +| `setCustomOption(key, value)` | `BugseeOptions(custom: {key: value})`. An unknown key is an `ArgumentError`, not silently dropped. | +| `BugseeFrameRate`, `BugseeVideoQuality`, `BugseeVideoMode` | `FrameRate`, `VideoQuality`, `VideoMode`. Enums carry the SDK's internal value. | +| `BugseeNetworkEventStage`, `BugseeNetworkEventNoBodyReason` | `NetworkStage`, `NoBodyReason` | + +## 5. Symbols for obfuscated builds + +The Dart symbols upload for `--split-debug-info` and `--obfuscate` is unchanged: it is still the manual `symbols.py` upload. See [Symbolication: Dart](/sdk/flutter/symbolication/dart). New in 10.x: the Android native symbol upload is opt-in, see [Symbolication: Android](/sdk/flutter/symbolication/android). + +## 6. Removed without a replacement + +- **Appearance** (`Bugsee.appearance`, `BugseeAppearance` and its styling surface): the 7.x appearance system differs per platform and is not exposed. +- APM transactions and spans, `relaunch`, secure activities and native views: not exposed. +- `BugseeHttpOverrides` as a public class: the capturing client is internal, use `installNetworkCapture`. +- `pause` and `resume`: use blackout. +- The test-crash calls and `setApplicationVersion`. + +## 7. Behavior changes that can surprise + +- A launch that was `true` in 9.x may be `alreadyRunning` or `deferred` in 10.x. Use `waitUntilLaunched()` instead of the boolean. +- Android auto-init (a token in the manifest) ignores the options passed to `Bugsee.launch`. +- Nothing is captured from `dart:io`, `print` or Dart errors until you install it. +- Unhandled Dart errors are error reports, not crash reports, unless `reportAsCrash: true`. +- Shake-to-report and the Android notification trigger are off by default. +- The first seconds of an Android session are not recorded, because of the startup hold. + +## 8. Checklist + +1. Raise Flutter to 3.50.0 or newer. +2. Android: apply the Bugsee Gradle plugin 4.1.1, build with JDK 17 or 21, and turn on `ndk { enabled.set(true) }` if you want native crashes readable. +3. iOS: raise the deployment target to 15.0 and enable Swift Package Manager. Remove CocoaPods usage of Bugsee. +4. Replace `launch(..., appRunCallback:, launchOptions:)` with `await Bugsee.launch(token, options: BugseeOptions(...))`, then `runApp`. +5. Move your launch options to `BugseeOptions` using the table in 4.8. +6. Call `installNetworkCapture`, `installLogCapture` and `installErrorHandlers` where you relied on the 9.x behavior. `print` is recorded only inside a zone that carries the hook, so run startup (the bindings, `launch` and `runApp`) inside `Bugsee.runWithLogCapture` or `Bugsee.runGuarded`; see [Console logs](/sdk/flutter/logs). +7. Rename `setEmail` to `setUserIdentifier` and review the value rules for attributes, events and traces. +8. Replace the attachments callback with a report handler, and the lifecycle callback with `lifecycleEvents`. +9. Replace `pause` and `resume` with blackout, and remove `addSecureRect` calls in favor of `BugseeSecureView`. +10. Move feedback calls to `bugsee_flutter_feedback`. +11. Rebuild a release, upload the symbols (see the [symbolication overview](/sdk/flutter/symbolication/overview)) and send a test error. diff --git a/docs/sdk/flutter/network.mdx b/docs/sdk/flutter/network.mdx new file mode 100644 index 00000000..f7a41a8e --- /dev/null +++ b/docs/sdk/flutter/network.mdx @@ -0,0 +1,182 @@ +--- +title: "Network capture" +description: "How Bugsee Flutter SDK 10.x records dart:io network traffic: installNetworkCapture, what a request records, body limits, setNetworkFilter, and what is never captured." +sidebar_position: 8 +slug: "/sdk/flutter/network" +--- + +:::warning[Beta] +This page documents Bugsee Flutter SDK **10.x**, which is in beta, is not published on pub.dev yet and can change between betas. The stable release is **9.x**: see the [9.x documentation](/sdk/flutter/v9/installation). Upgrading? See [Migrating from 9.x to 10.x](/sdk/flutter/migration). +::: + +Bugsee records the HTTP requests your app makes, with their headers, bodies and status codes, and shows them on the report timeline next to the video and logs. + +Dart does not use the platform's networking stack. `dart:io`'s `HttpClient` is what `package:http`, the default adapter of `dio`, `Image.network` and the WebSocket handshake are built on, and neither native SDK sees it. The plugin therefore records it in Dart, through `HttpOverrides`, and hands each event to the native SDK, which applies its network options and privacy rules as it does to the traffic it intercepts itself. + +This capture is **opt-in**: `launch` never turns it on. + +## Enabling capture + +Call `Bugsee.installNetworkCapture()` once, early in `main`, before the app makes a request: + +```dart +import 'package:bugsee_flutter/bugsee_flutter.dart'; +import 'package:flutter/widgets.dart'; + +void main() { + Bugsee.installNetworkCapture(); + runApp(const MyApp()); +} + +// Later: Bugsee.launch(...). Nothing is recorded before the SDK is launched. +``` + +| Member | Description | +| --- | --- | +| `Bugsee.installNetworkCapture()` | Starts the capture. Returns whether it is in effect (`false` on a platform with no SDK, such as web and desktop). Idempotent. | +| `Bugsee.uninstallNetworkCapture()` | Stops it. | +| `Bugsee.networkCaptureInstalled` | Whether `installNetworkCapture` was called and not undone. | +| `Bugsee.setNetworkFilter(filter, {timeout})` | Sets the [filter](#filtering-events). `null` removes it. | +| `Bugsee.networkFilter` | The filter that is set, or `null`. | +| `Bugsee.networkCaptureStats` | Counters for diagnosis: [`NetworkCaptureStats`](#diagnosing-capture). | + +Things to know about installing: + +- **Call it from the root isolate.** A call from a background isolate throws a `BugseeException`. +- **Install it after your own `HttpOverrides`.** The capture puts its overrides in front of `HttpOverrides.current` and chains to them: clients, `badCertificateCallback`, proxy settings and `findProxy` stay yours. If you set `HttpOverrides.global` afterwards without chaining, you replace the capture; call `installNetworkCapture` again to put it back in front. +- **Do not call it inside a zone that scopes its own overrides** (`HttpOverrides.runZoned`). It throws a `BugseeException` instead of making that scope global. +- **Hot restart** starts clean: the new isolate's `main` calls `installNetworkCapture()` again. +- **The capture never changes what your app sees.** Every call is forwarded to the real client unchanged, a response chunk reaches your code in the same turn it arrives, and a failure inside the capture is never thrown into your code. The app's request path pays for a queue insert; filtering and the bridge call happen in a later turn of the event loop. + +## What is recorded + +An exchange is recorded as several entries that share an id: + +| Stage | When | Carries | +| --- | --- | --- | +| `before` | The request is closed with `request.close()`. | Method, URL, request headers, request body, size. | +| `redirect` | One per hop that `dart:io` followed. Android only. | The URL that answered and its status. | +| `complete` | The response body ended. | Status, response headers, body, size, `redirectedFrom` when redirected. | +| `error` | The request failed: no connection, certificate refusal, connection timeout, connection closed while the body was arriving. | Short and long error text. | +| `abort` | The app cancelled the response subscription or called `request.abort()`. | Size so far. | + +Any HTTP status is a `complete`, 4xx and 5xx included; `error` is for failures that never produced a response. + +- A request is recorded when it is closed, not when it is opened. A request your app never closes is never recorded. +- A response completes when its body stream ends. A response your app never listens to never completes. +- Header names are lower-case, and a header sent more than once is one entry joined with `, `. +- The headers of `before` are the ones `dart:io` holds when the request is closed: yours, plus the ones `dart:io` sets itself (`host`, `user-agent`, `accept-encoding`, `content-length` or `transfer-encoding`). Cookies added through `request.cookies` are not part of them. +- A redirect your app follows itself (`followRedirects = false`, then `response.redirect()`) is a new exchange for each response. + +### Differences between the platforms + +| | Android | iOS | +| --- | --- | --- | +| `redirect` stage | Recorded for each hop. | None. The final `complete` carries the original URL in `redirectedFrom`. | +| `timings` (`ttfb`, `download`, `total`, in milliseconds) | Recorded. | Not available. | +| Reason phrase (`statusText`) | Recorded. | Not available. | +| Error text | Short and long. | One text. | + +### Bodies + +Bodies follow the native SDK's own rules, which the plugin applies **before copying anything**, so memory stays bounded by the limit and a binary body is counted but never copied. + +| Option | Default | Effect | +| --- | --- | --- | +| `captureNetwork` | `true` | `false` captures and sends nothing. | +| `captureNetworkBodySizeLimit` | `20480` | Largest body kept, in bytes. A body over the limit is **dropped, not cut**; its size is still reported. A limit of `0` keeps no body. The plugin caps this value at 2 MiB: above that, a body over 2 MiB is dropped as if it exceeded the limit. | +| `captureNetworkBodyWithoutType` | `false` | Without it, a body needs a `Content-Type` that is text (`text/*`, or a subtype containing `json`, `xml` or `x-www-form-urlencoded`). With it, the type check is skipped. | +| `captureNetworkDefaultSanitizer` | `true` | The SDK's redaction; see [Privacy: Network](/sdk/flutter/privacy/network). | + +A body that is not recorded carries a reason (`NoBodyReason`): `noData`, `sizeTooLarge`, `unsupportedContentType`, `noContentType` or `cantReadData`. A response that is still compressed (`autoUncompress` off), a charset other than UTF-8, Latin-1 or ASCII, and bytes that are not valid text are all `cantReadData`. With `autoUncompress` on (the default), `dart:io` decompresses the response and the body is the text. + +Request and response bodies are governed by the same options: there is no separate switch for request bodies. To capture no body at all, set `captureNetwork` off, or the limit to `0`. + +```dart +await Bugsee.launch( + 'YOUR_APP_TOKEN', + options: const BugseeOptions( + captureNetworkBodySizeLimit: 8192, + ), +); +``` + +## Filtering events + +`Bugsee.setNetworkFilter` sets a Dart function that every event passes through before anything is handed to the SDK. Return the event (changed in place, or a copy) to record it, or `null` to drop it: + +```dart +Bugsee.setNetworkFilter((event) { + if (Uri.parse(event.url).host == 'internal.example.com') return null; // not recorded + event.headers.remove('x-session'); // redact in place + return event; +}); +``` + +The filter receives a `BugseeNetworkEvent`: + +| Field | Type | Notes | +| --- | --- | --- | +| `id` | `String` | Shared by every stage of one request. Read-only. | +| `stage` | `NetworkStage` | `before`, `redirect`, `complete`, `error` or `abort`. Read-only. | +| `method` | `String` | Read-only. | +| `statusCode` | `int` | `0` for a stage with no response. Read-only. | +| `size` | `int` | Body bytes seen, whether or not they were kept. Read-only. | +| `url` | `String` | The full URL, query included. A filter that blanks it drops the event. | +| `headers` | `Map` | Request headers for `before`, response headers for the stages that have a response. | +| `body` | `String?` | Text only, within the size limit. | +| `noBodyReason` | `NoBodyReason?` | Why `body` is `null`. | +| `statusText`, `error`, `errorDescription`, `redirectedFrom` | `String?` | As described above. | +| `timings` | `Map?` | Android only. | + +`id`, `stage`, `method`, `statusCode` and `size` describe what happened. If a filter changes them, the change is ignored, so a filter cannot break the pairing of the stages of one exchange. + +Properties of the filter: + +- **It runs in Dart, so it cannot be bypassed.** There is no path to the SDK that does not go through it. It sees the raw event: headers, the URL with its query, and the body. +- **It fails closed.** A filter that throws, returns something other than a `BugseeNetworkEvent` or `null`, or returns a `Future` that does not complete within its timeout drops that event. A debug build prints a warning once, and `networkCaptureStats.filterFailures` counts them. A filter that never answers drops one event per timeout while the queue fills, so capture degrades to nothing, never to unfiltered. +- **The timeout** is the `timeout` argument of `setNetworkFilter`: 10 seconds by default, which is the SDK's own filter timeout. It must be positive and at most 5 minutes, or `setNetworkFilter` throws a `BugseeArgumentException`. +- **It runs on the isolate that made the request** (normally the UI isolate), one event at a time and in order, never inside the HTTP call. A slow synchronous filter takes UI time, so keep it fast. It may return a `Future`. +- **It gets a copy.** Changing the event cannot reach what the capture still holds. +- **The SDK still runs afterwards.** Every event is submitted with filtering required, so the native pipeline runs on what your filter returns: the app's native network filter if there is one, otherwise the SDK's default sanitizer. A native filter replaces the sanitizer. See [Privacy: Network](/sdk/flutter/privacy/network). + +## What is never recorded + +- Anything while the SDK is not `launched`, after `stop`, or with `captureNetwork` off. A request that began before the launch is never recorded; one that began while launched is recorded to its end. +- **Bugsee's own traffic**: any host `bugsee.com` or below, and the host of the configured `endpoint`. +- WebSocket frames. The handshake is recorded as a normal exchange (`101`, no body). The frames are not; record them yourself with `Bugsee.event` or `Bugsee.trace` if you need them. +- Requests made in another isolate. `HttpOverrides.global` is per isolate and a background isolate has no channel to the SDK. Make the request in the root isolate. +- Requests made through a stack that is not `dart:io`. +- Requests from a client that was created before `installNetworkCapture` by code that keeps it (a `static final HttpClient`, an app-wide singleton), and the first `WebSocket` if it was used before the install. Install first, in `main`. +- Requests while another `HttpOverrides` replaced the capture without chaining, or inside a zone with its own overrides. + +Native networking stacks (`cronet_http`, `cupertino_http`, `native_dio_adapter`, a WebView, a platform channel) go through the native SDKs' own interception, not this capture. An app that uses both sees each request once, from its own stack. + +## Limits + +- The capture queue holds 512 events or 8 MiB, and hands the SDK batches of at most 32 events or 512 KiB, one batch at a time. If the native side cannot keep up, the **newest** events are dropped and counted in `networkCaptureStats.droppedQueueFull`; a debug build prints a warning once. +- A body near the 2 MiB cap weighs about twice that in the queue, so a second large body queued before the first one drains can be dropped as `droppedQueueFull`. +- The app's own timeout (`Future.timeout` on `close()`) does not cancel the request, so the exchange completes when the server answers. `request.abort()` records an `abort`. +- `uninstallNetworkCapture` stops recording at once, including an exchange in flight. Events that were already captured and filtered are still submitted, unless the SDK is no longer launched. +- Each event carries its age, so the timeline shows when the request happened, not when the event was handed over. + +## Diagnosing capture + +`Bugsee.networkCaptureStats` returns a `NetworkCaptureStats`: + +| Counter | Counts | +| --- | --- | +| `captured` | Events the capture produced and the queue took. | +| `submittedToSdk` | Events the native side submitted to the SDK. This is not "recorded": the SDK can still drop an event silently if its provider is stopped. | +| `droppedQueueFull` | Events dropped because native could not keep up. | +| `droppedNotAccepting` | Events dropped because the SDK stopped accepting them (a stop, or `captureNetwork` off) before they were handed over. | +| `droppedByFilter` | Events your filter answered `null` for. | +| `filterFailures` | Events dropped because the filter threw, returned an unusable value or timed out. | +| `refusedByNative` | Events handed to native and not taken by the SDK. | +| `sendFailures` | Events lost with a batch the bridge failed to deliver. | + +## Related pages + +- [Privacy: Network](/sdk/flutter/privacy/network): what the SDK redacts, what your filter should remove, and where the URL can still leak. +- [Configuration](/sdk/flutter/configuration): the full option list. +- [Lifecycle](/sdk/flutter/lifecycle): launch and stop. diff --git a/docs/sdk/flutter/overview.md b/docs/sdk/flutter/overview.md new file mode 100644 index 00000000..8342c5b2 --- /dev/null +++ b/docs/sdk/flutter/overview.md @@ -0,0 +1,83 @@ +--- +title: "Overview" +description: "What the Bugsee Flutter SDK 10.x records and detects, how it wraps the native Android and iOS SDKs, and what your app needs to run it." +sidebar_position: 0 +slug: "/sdk/flutter/overview" +--- + +:::warning[Beta] +This page documents Bugsee Flutter SDK **10.x**, which is in beta, is not published on pub.dev yet and can change between betas. The stable release is **9.x**: see the [9.x documentation](/sdk/flutter/v9/installation). Upgrading? See [Migrating from 9.x to 10.x](/sdk/flutter/migration). +::: + +The Bugsee Flutter SDK (`bugsee_flutter`) captures what happened before a bug: a video of the screen, network traffic, console logs and the steps that led to it. It attaches that timeline to crash, error and bug reports you can replay in the Bugsee dashboard. + +The package wraps the native Bugsee 7.x SDKs for Android and iOS; it adds a Dart layer on top of them. A report from a Flutter app is the report a native app produces, plus what only Dart can see: the widget tree, `dart:io` network traffic, `print` output and Dart errors. + +10.x is a rewrite for the 7.x native SDKs and a breaking change from 9.x. There is no compatibility layer: stay on 9.x or follow the migration guide. See [Migrating from 9.x to 10.x](/sdk/flutter/migration). + +## What Bugsee records + +Every report carries a synchronized timeline of the session that led up to it: + +- **Video**: a rolling recording of the screen. Wrap anything that must never be recorded in `BugseeSecureView`, and keep the secure view mounted before sensitive content appears: the first frame of a newly appearing region can still be recorded (use blackout before showing it). See [Privacy: Video](/sdk/flutter/privacy/video). +- **Network**: the native SDKs cannot see `dart:io` (`package:http`, the default adapter of `dio`, `Image.network`, a plain `HttpClient`), so the plugin records it in Dart and hands the events to the SDK. This is opt-in; see [Network capture](/sdk/flutter/network). +- **Console logs**: `print` and `debugPrint` output, opt-in, and lines from your own logger through `forwardLog`; see [Console logs](/sdk/flutter/logs). Lines you send with `Bugsee.log` are recorded once the SDK has launched, with no opt-in. +- **Widget tree**: the Flutter widget tree, as boxes and widget type names only (no text, field values, keys or route names); see [View hierarchy](/sdk/flutter/view-hierarchy). +- **Breadcrumbs, custom events, traces and attributes**: see [Custom events & traces](/sdk/flutter/events-and-traces) and [User & session data](/sdk/flutter/user-session-data). Breadcrumb capture is off until you turn it on. + +## What Bugsee detects + +- **Native crashes**: on Android, uncaught Java and Kotlin exceptions and native crashes (the NDK crash handler); on iOS, uncaught Objective-C exceptions and fatal signals. The native SDKs also detect app hangs, when you turn that on with the `detectHang` option. +- **Dart errors**: you report handled errors yourself with `Bugsee.logException`, and can opt in to the errors nobody handled with `Bugsee.installErrorHandlers`. They are filed as error reports by default, not crash reports. See [Crash & error reporting](/sdk/flutter/manual/crash-error-reporting) and [Dart errors](/sdk/flutter/dart-errors). +- **Manual reports**: open the report dialog or upload a report from code, or turn on a built-in trigger such as shake to report (off by default); see [Bug reporting](/sdk/flutter/manual/bug-reporting). + +## How it works + +- **One package, two native SDKs.** The Android SDK comes through Gradle and the iOS SDK through Swift Package Manager. There is no CocoaPods pod. +- **Launch from Dart.** One call, `Bugsee.launch(token, options: ...)`, starts the SDK; see [Installation](/sdk/flutter/installation) and [Lifecycle & status](/sdk/flutter/lifecycle). On Android the SDK can also launch itself before any Dart code runs. +- **One option class.** `BugseeOptions` has a typed field for every option the two SDKs register, and one set of options configures both platforms; see [Configuration](/sdk/flutter/configuration). +- **Privacy on the device.** Secure views, blackout, and Dart-side filters for network and log data that run before anything reaches the SDK; see [Privacy](/sdk/flutter/privacy/overview). +- **Readable release reports.** Android mapping files upload with the Bugsee Gradle plugin. Android native symbols, iOS dSYMs and Dart symbols need a step from you; see [Symbolication](/sdk/flutter/symbolication/overview). +- **Automatic upload.** Reports upload to the dashboard in the background. + +The in-app feedback chat ships separately, as `bugsee_flutter_feedback`, so apps that never show it do not carry its UI; see [Feedback](/sdk/flutter/feedback). + +## What is opt-in + +Nothing below is turned on by `Bugsee.launch`: + +| Capability | How to turn it on | +| --- | --- | +| Network capture of `dart:io` | `Bugsee.installNetworkCapture()` | +| `print` and `debugPrint` capture | `Bugsee.installLogCapture()`, with `print` also needing a zone: `Bugsee.runWithLogCapture` or `Bugsee.runGuarded` | +| Capture of unhandled Dart errors | `Bugsee.installErrorHandlers()` | +| Breadcrumbs | `BugseeOptions(captureBreadcrumbs: true)` | +| Shake to report | `BugseeOptions(reportingTriggersShake: true)` | + +## Requirements + +| | | +| --- | --- | +| Flutter / Dart | 3.50.0 or later / 3.14 or later | +| Android | `minSdk` 21; JDK 17 or 21 for the build; the Bugsee Gradle plugin 4.1.1, applied by your app | +| iOS | 15.0 or later; Swift Package Manager only | +| Not covered | web, desktop (the calls do nothing there), tvOS, visionOS | + +## Versions + +This beta, `10.0.0-beta.1`, is built on these native SDKs: + +| Platform | Native SDK | Notes | +| --- | --- | --- | +| Android | `com.bugsee:bugsee-android` 7.6.0 | Bugsee Gradle plugin 4.1.1 is mandatory | +| iOS | Bugsee iOS SDK 7.1.0 | Distributed through Swift Package Manager | + +## Platform notes + +- The API works from the main isolate. A call from a background isolate is a `BugseeException`. +- On web and desktop the calls do nothing, and `Bugsee.launch` throws a `BugseeLaunchException`. +- The iOS simulator has no crash reporter and files no logged exceptions, so crash recovery and Dart error reports need a physical iPhone to try. + +## Get started + +Head to [Installation](/sdk/flutter/installation). From there, [Configuration](/sdk/flutter/configuration) covers the launch options, and [Privacy](/sdk/flutter/privacy/overview) covers redaction. diff --git a/docs/sdk/flutter/privacy/logs.md b/docs/sdk/flutter/privacy/logs.md index 3dee0f66..70c924a9 100644 --- a/docs/sdk/flutter/privacy/logs.md +++ b/docs/sdk/flutter/privacy/logs.md @@ -1,30 +1,110 @@ --- -title: "Privacy and console logs" -description: "How to disable console log collection or sanitize log content in Flutter to remove personally identifiable information before it is recorded." -sidebar_position: 2 +title: "Privacy: Console logs" +description: "How to keep sensitive data out of the logs Bugsee Flutter SDK 10.x records: turning capture off, setLogFilter, the missing SDK sanitizer, and the Android logcat echo that the Dart filter does not cover." +sidebar_position: 15 slug: "/sdk/flutter/privacy/logs" --- -## Disabling log collection +:::warning[Beta] +This page documents Bugsee Flutter SDK **10.x**, which is in beta, is not published on pub.dev yet and can change between betas. The stable release is **9.x**: see the [9.x documentation](/sdk/flutter/v9/installation). Upgrading? See [Migrating from 9.x to 10.x](/sdk/flutter/migration). +::: -Console log collection can be disabled completely using **captureLogs** launch option. See [configuration](/sdk/flutter/configuration/) for more info. +Log lines often carry more than you meant to share: an access token in a URL, an e-mail address in a debug message, a payload dumped while a feature was being built. Bugsee records what Dart prints when you turn on [log capture](/sdk/flutter/logs), the native console of the app, and the lines you send with `Bugsee.log`. This page covers how to keep sensitive data out of them. -## Sanitizing console logs +Two facts shape everything below: -Bugsee automatically captures all standard application console logs, but they can be protected as well. +- **The SDKs have no log sanitizer.** Unlike network events, nothing redacts a log line by rule. A line is recorded as printed unless your filter changes it. A line such as `card 4111111111111111 password=hunter2` printed with no filter was recorded verbatim on both platforms. +- **On Android the same line can be recorded twice, and the Dart filter covers only one copy.** See [the Android logcat echo](#the-android-logcat-echo). -For every event to be recorded, Bugsee will call your method and provide you with a **BugseeLogEvent** object. It is your -method's responsibility to clean up all user identifiable data from that structure and return a sanitized event back +## Do not enable what you do not need -### Providing handler +Capturing `print` and `debugPrint` is opt-in: nothing from Dart is recorded until you call `Bugsee.installLogCapture()`. If you never call it, the lines your app prints are not recorded by the plugin. -You should pass a callback method to Bugsee.setLogFilter(). +`Bugsee.log` is a deliberate call, is always recorded and bypasses the filters: do not pass it anything you would not send. + +## Disabling log capture + +Set `captureLogs` to `false` to stop automatic log capture, on both routes: the plugin's capture of `print` and `debugPrint`, and the SDK's own console capture, which includes the Android logcat echo. + +```dart +import 'package:bugsee_flutter/bugsee_flutter.dart'; + +await Bugsee.launch( + 'YOUR_APP_TOKEN', + options: const BugseeOptions(captureLogs: false), +); +``` + +Lines you send with `Bugsee.log` are still recorded with `captureLogs` off: the option turns off only what is captured automatically. + +## Filtering with setLogFilter + +`Bugsee.setLogFilter` is where redaction of the lines the plugin records belongs. It runs in Dart, so nothing this capture records can skip it, and it sees each line before anything leaves the isolate. Return the event to keep it (modified if you like), or `null` to drop it: ```dart -Future onBugseeLogEvent(BugseeLogEvent logEvent) { - logEvent.text = "Filtered: " + logEvent.text; - return Future.value(logEvent); -} +Bugsee.setLogFilter((event) { + if (event.message.contains('password')) return null; // drop the line + event.message = event.message.replaceAll(RegExp(r'\b\d{16}\b'), ''); + return event; +}); +``` + +It receives a `BugseeLogEvent` with a mutable `message`, `level` and `tag`. Remember: + +- **A filter that returns the event with the secret untouched leaks it.** Where you can, write an allow-style rule, and keep secrets out of `print` in the first place. +- **It fails closed.** A filter that throws, returns something other than a `BugseeLogEvent` or `null`, or returns a `Future` that does not complete within its timeout (10 seconds by default, at most 5 minutes) drops that line. A debug build warns once, and `Bugsee.logCaptureStats.filterFailures` counts the drops. +- **A filter that never answers is switched off for 30 seconds** after three timeouts in a row, and its lines are dropped at once. +- **A filter you remove or replace still applies to what was queued under it.** +- **An empty message drops the line.** +- **Your native filter runs next.** If the app set a log filter on the native SDK, it runs on what the Dart filter returned, for every source other than `Bugsee`. +- **It does not apply to `Bugsee.log`**, nor to the SDK's own console capture. +- **Set it before lines are printed.** The filter applies to lines recorded after it is set; set it at the top of `main`, next to `installLogCapture`. + +## The Android logcat echo + +On Android the SDK reads the process's logcat on its own, where the Flutter engine writes every `print` and `debugPrint`. That copy is recorded raw as source `LogCat` with the tag `flutter`, **whatever your Dart filter did to the plugin's copy**: -Bugsee.setLogFilter(onBugseeLogEvent); +```text +source level tag message +3 3 flutter card 4111111111111111 for order 7 <- the SDK's logcat capture: the Dart filter never ran on it +98 3 print card for order 7 <- this plugin, after the Dart filter ``` + +The same applies to the `FlutterError` dump of a real app: its widget tree is written to logcat, and only the plugin's own copy is withheld. + +No launch option turns the echo off on its own. `captureLogs` turns off both routes, and `captureLogsAllSources` only widens what the SDK reads. The options are not enough, so choose one of: + +- **Add a native filter** in the host app that drops or redacts the echo. It runs on every source other than `Bugsee`: + + ```kotlin + Bugsee.setLogEventFilter { event, callback -> + when { + // The plugin's own lines (source Custom) were filtered in Dart already. + event.logSource == LogSource.LogCat && event.tag == "flutter" -> callback.run(null) // drop the echo + else -> callback.run(event) + } + } + ``` + + Native filter reference: [Android: Privacy: Console logs](/sdk/android/privacy/logs). +- **Keep the secret out of `print`.** What is never printed is never in logcat. +- **Turn `captureLogs` off**, which stops the echo and the plugin's capture together. + +iOS recorded no echo on the simulator: Flutter's `print` on iOS did not reach the stdout the SDK intercepts. This was not verified on a physical device or in a release build. + +A debug build on Android prints a warning once when you set a Dart filter while `captureLogs` is on. + +## Lines the plugin never records + +- The `FlutterError` diagnostics dump, which carries widget trees and property values. The error itself is reported by [`Bugsee.reportException`](/sdk/flutter/manual/crash-error-reporting) and the [installed error handlers](/sdk/flutter/dart-errors). On Android the logcat echo can still record the dump. +- The plugin's own `bugsee_flutter:` messages. +- A `print` in the root zone, `dart:developer`'s `log()`, `stdout` and `stderr` writes, and output of another isolate. The SDK's own console capture may still record what reaches the console. + +## Level threshold + +`captureLogsLevel` drops lines more verbose than the level you set. It keeps chatty debug output out of reports, and it is not a privacy control: a secret printed at `error` passes any threshold. The plugin applies it to the lines it records on both platforms. The level of `print` and `debugPrint` lines is the `level` you pass to `installLogCapture` (default `LogLevel.info`). + +## Related pages + +- [Console logs](/sdk/flutter/logs): how capture works. +- [Privacy overview](/sdk/flutter/privacy/overview) diff --git a/docs/sdk/flutter/privacy/network.md b/docs/sdk/flutter/privacy/network.md index 9ae33490..9d4b6a10 100644 --- a/docs/sdk/flutter/privacy/network.md +++ b/docs/sdk/flutter/privacy/network.md @@ -1,56 +1,116 @@ --- -title: "Privacy and Network traffic" -description: "How to disable network monitoring or filter sensitive data from captured network requests and responses in Flutter using a callback handler." -sidebar_position: 3 +title: "Privacy: Network" +description: "How to keep credentials and personal data out of the network traffic Bugsee Flutter SDK 10.x records: opt-in capture, the Dart filter that runs first and fails closed, the SDK sanitizer, and the URL in Android HTTP breadcrumbs." +sidebar_position: 16 slug: "/sdk/flutter/privacy/network" --- -## Disabling network traffic collection +:::warning[Beta] +This page documents Bugsee Flutter SDK **10.x**, which is in beta, is not published on pub.dev yet and can change between betas. The stable release is **9.x**: see the [9.x documentation](/sdk/flutter/v9/installation). Upgrading? See [Migrating from 9.x to 10.x](/sdk/flutter/migration). +::: -Network traffic collection can be disabled completely using the **monitorNetwork** launch option. This covers both Dart and native platform traffic — with `monitorNetwork` set to `false`, nothing is captured even if the HTTP overrides handler below is installed. See [configuration](/sdk/flutter/configuration/) for more info. +Recorded network traffic is one of the most useful parts of a report, and one of the most sensitive: request headers carry credentials, URLs carry tokens, and bodies carry whatever the user typed. [Network capture](/sdk/flutter/network) explains what the plugin records; this page covers how to keep sensitive values out of it. -## Initializing -In order to let Bugsee intercept network traffic, the following needs to be added to the launch code of your app. +## The order things happen in + +Every captured event passes through these steps, in this order: + +1. **The Dart filter** (`Bugsee.setNetworkFilter`), if you set one. It sees the raw event, and nothing leaves Dart before it has run. +2. **Plugin redaction of URLs and errors**, always (see [What the plugin always removes](#what-the-plugin-always-removes)). +3. **The native SDK.** Every event is submitted with filtering required, so the SDK runs its own pipeline on what your filter returned: **the filter you set on the native SDK**, if the app set one (`Bugsee.setNetworkEventFilter` from Kotlin or Swift), **or else the default sanitizer**. +4. The SDK's body limits, and the report. + +## Capture is opt-in, and off until launch + +`installNetworkCapture` is never called by `launch`. If you do not call it, the plugin records no `dart:io` traffic. Even when installed, nothing is recorded while the SDK is not `launched`, after `stop`, or with `captureNetwork` off. Requests to Bugsee itself (any host `bugsee.com` or below, and the host of the configured `endpoint`) are never recorded. + +Set `captureNetwork` to `false` to record no network traffic at all: ```dart -HttpOverrides.global = Bugsee.defaultHttpOverrides; +import 'package:bugsee_flutter/bugsee_flutter.dart'; + +await Bugsee.launch( + 'YOUR_APP_TOKEN', + options: const BugseeOptions(captureNetwork: false), +); ``` -## Sanitizing data +## Body options -Bugsee captures network activity from the application and stores headers and in some cases body of the request and response. -In order to allow you to hide user identifiable and other sensitive data from these network logs, we provide you with the -ability to set your own filter via a callback we will call for every event about to be recorded. +| Option | Default | Effect | +| --- | --- | --- | +| `captureNetworkBodySizeLimit` | `20480` | Largest body kept, in bytes. A body over the limit is dropped, not cut. `0` keeps no body. The plugin caps the value at 2 MiB. | +| `captureNetworkBodyWithoutType` | `false` | Skips the content-type check, so bodies with no type, and bodies with any declared type (binary included, when they are readable text), are kept. Leave it off unless you need them. | -For every event to be recorded, Bugsee will call your method and provide you with an **BugseeNetworkEvent** object. It is your -method's responsibility to clean up all user identifiable data from that structure and return a sanitized event back. +By default only **text** bodies are recorded: `text/*`, and types containing `json`, `xml` or `x-www-form-urlencoded`; with `captureNetworkBodyWithoutType` on, the type check is skipped. A binary body is counted and never copied. Request bodies and response bodies follow the same options; there is no separate switch for request bodies. +Neither option removes headers or URL parameters. Use the [Dart filter](#redacting-with-a-dart-filter) and the SDK sanitizer for those. -### Providing handler +## The SDK sanitizer -You should pass a callback method: +With `captureNetworkDefaultSanitizer` on (the default), the native SDK redacts known sensitive values after your Dart filter has run: query parameters, header values and JSON body values with sensitive keys. ```dart -Future onBugseeNetworkEvent(BugseeNetworkEvent e) { - e.url = ""; - return Future.value(e); -} +await Bugsee.launch( + 'YOUR_APP_TOKEN', + options: const BugseeOptions(captureNetworkDefaultSanitizer: true), // the default +); +``` + +Three things to know: + +- **A Dart filter does not replace it.** The SDK's own filter slot is the native one, which stays the app's. A Dart filter that returns the event with `authorization` untouched still gets it redacted by the sanitizer, unless you turned the option off. +- **It is skipped when the app set a native network filter.** The documentation of both SDKs says the sanitizer applies only when no network event filter is set. If you set one natively, it runs on the event after the Dart filter, and **it replaces the sanitizer**: it must redact what you do not want sent. +- **Its rules are the SDKs' and differ per platform.** In the verification, the same `x-session: s1` request header was redacted on Android and kept on iOS. `authorization`, `set-cookie`, the `token` query parameter and JSON `token` and `password` values were redacted on both. The sanitizer knows nothing about your own API: redact in the Dart filter whatever must be hidden on both platforms. + +The native SDK documents its rules: [Android network privacy](/sdk/android/privacy/network) and [iOS network privacy](/sdk/ios/privacy/network). + +## Redacting with a Dart filter -Bugsee.setNetworkFilter(onBugseeNetworkEvent); +```dart +Bugsee.setNetworkFilter((event) { + final uri = Uri.parse(event.url); + if (uri.host == 'internal.example.com') return null; // drop the event + event.headers.remove('x-session'); // redact in place + event.body = null; // or hide a body + return event; +}); ``` -### Network Events +Set it at the top of `main`, next to `installNetworkCapture`, so it is in place for the first request. + +- **It cannot be bypassed.** It runs in Dart, and there is no path to the SDK that does not go through it. It sees the raw event: headers, the URL with its query, and the body. +- **It fails closed.** A filter that throws, returns something other than a `BugseeNetworkEvent` or `null`, or returns a `Future` that does not complete within its timeout (10 seconds by default, at most 5 minutes) drops that event. Capture degrades to nothing, never to unfiltered. `Bugsee.networkCaptureStats.filterFailures` counts the drops. +- **`id`, `stage`, `method`, `statusCode` and `size` cannot be changed**: a change is ignored. A filter that blanks the URL drops the event. +- **Keep it fast and independent.** It runs on the isolate that made the request, one event at a time, in order. It must not call back into code that waits for the HTTP request it is filtering. +- **A filter you remove or replace** still applies to events that were queued under it. + +## What the plugin always removes + +These happen in Dart, whatever your filter returned: + +- **Userinfo in URLs** (`user:password@host`, which `dart:io` accepts and turns into Basic auth) is stripped from `url`, `redirectedFrom`, URL-valued headers and error texts. The check is made once more on the way out, on whatever a filter returned. +- **Fragments** are dropped from every recorded URL and URL-valued header, because OAuth callbacks can put tokens in a redirect's `Location` fragment and no SDK looks at fragments. +- **URL-valued headers** (`location`, `content-location`, `referer`, `refresh`, in requests and responses) lose userinfo and every query **value**: `?token=abc` becomes `?token=`. Neither SDK sanitizes a header by its value, only by its name. Other headers are the SDK sanitizer's business. +- **Error texts** of an `error` entry never carry a URL's query string or userinfo. +- **Request cookies** set through `request.cookies` are not captured. The response's `Set-Cookie` is a response header, so the sanitizer's rules apply to it (redacted on both platforms in the verification). + +## HTTP breadcrumbs + +With `captureBreadcrumbs` on, the SDK records an `http` breadcrumb for each finished request, with its URL. The breadcrumb sees the event **after your Dart filter and before the SDK sanitizer**. + +In the verification, **Android recorded that URL verbatim** (`?token=abc123` stayed), which the SDK documents as the user's job through a breadcrumb filter, while iOS applied its query sanitizer to it. The SDK's option documentation for `captureNetworkDefaultSanitizer` says it also redacts the URL of `http` breadcrumbs; that was not re-measured with this plugin. Do not depend on it: **redact the URL in the Dart network filter**, which runs first and protects the breadcrumb on both platforms. + +`setBreadcrumbFilter` is not exposed by this plugin. A breadcrumb filter the app set on the native SDK still applies. + +## What is not covered -The callback is going to be called several times for each network request, depending on its life cycle. Usually for -successful requests it's going to be called twice, once with the request event (request headers and body) and one more time after -completion and will contain headers and body of the response. Note that callback can be called more times, initially without body and then with it for both request and response. +- **Data you pass yourself.** A URL you pass to `Bugsee.event`, `Bugsee.trace`, `Bugsee.log`, `Bugsee.addBreadcrumb` or an attribute is yours to redact. +- **Native stacks.** Traffic from `cronet_http`, `cupertino_http`, `native_dio_adapter`, a WebView or a platform channel goes through the native SDKs' own interception, not through the Dart filter. Set a native network filter if that traffic matters. +- **WebSocket frames** are not captured at all; the handshake is a normal exchange and passes through the filter. +- **Other isolates** are not captured. +## Related pages -|Property|Description|Type|Read only|Notes -|---|---|---|---|---| -|body|Body|String|No|Raw body of the request or response where available. -|type|Type of network event|String|No|Can be one of 'before', 'complete', 'error', 'cancel' -|headers|HTTP Headers|Map|No| -|method|HTTP Request Method|String|No|'GET', 'POST', etc... -|redirectUrl|URL of Network event that we were redirected from|String|No| -|Url|Network event URL|String|No| \ No newline at end of file +- [Network events](/sdk/flutter/network): what is recorded and the capture limits. +- [Privacy overview](/sdk/flutter/privacy/overview) diff --git a/docs/sdk/flutter/privacy/overview.md b/docs/sdk/flutter/privacy/overview.md index 6fe63f81..5762a00d 100644 --- a/docs/sdk/flutter/privacy/overview.md +++ b/docs/sdk/flutter/privacy/overview.md @@ -1,17 +1,50 @@ --- title: "Privacy overview" -description: "Overview of privacy considerations and available tools to prevent or sanitize personally identifiable data in Bugsee Flutter SDK reports." -sidebar_position: 0 +description: "The privacy controls of Bugsee Flutter SDK 10.x: what a report can contain, the control for each kind of data, and the limits you need to know about." +sidebar_position: 13 slug: "/sdk/flutter/privacy/overview" --- -Bugsee SDK does not continuously stream any personal data. The reports are stored locally on the phone in a cyclical buffer. Reports are being sent only when triggered by a crash, through a bug reporting UI or from an application's code. -Data sent along with the reports may include video recording of screen, network and console logs. These may potentially contain personal data (usernames, passwords, emails, etc). +:::warning[Beta] +This page documents Bugsee Flutter SDK **10.x**, which is in beta, is not published on pub.dev yet and can change between betas. The stable release is **9.x**: see the [9.x documentation](/sdk/flutter/v9/installation). Upgrading? See [Migrating from 9.x to 10.x](/sdk/flutter/migration). +::: -It is the sole responsibility of the application developers to remove any such data from the reports before it leaves the users’ device. +Bugsee records what makes a bug reproducible, so decide what must not be recorded. The SDK keeps what it captures in a rolling buffer on the device and sends it only when a report is created: by a crash or an error, from the report dialog, or from your code. A report can contain personal data (the screen video, touches, logs, network traffic, breadcrumbs, attributes and the text the user typed), and the SDK gives you a control at each point where that data is recorded. -Bugsee provides the tools and means to either prevent some data from being collected or clean the data during the collection process: +Three parts of the Flutter SDK matter here, and they behave differently: -* [Video and Touch](/sdk/flutter/privacy/video/) -* [Console logs](/sdk/flutter/privacy/logs/) -* [Network logs](/sdk/flutter/privacy/network/) \ No newline at end of file +- **The native SDKs** record the video, the screenshot, touches and device information. You control them with launch options, `BugseeSecureView` and blackout. +- **The plugin** records what only Dart can see: the widget tree, `dart:io` network traffic, `print` output and Dart errors. Network and log capture are **opt-in**, and a Dart filter runs before anything reaches the SDK. +- **Your own calls** (`Bugsee.log`, events, attributes, `Bugsee.reportException`) record what you pass. + +## What is captured, and the control for each + +| Captured | Control | +| --- | --- | +| Video and report screenshot of the app | [`BugseeSecureView`](/sdk/flutter/privacy/video#hiding-a-widget-bugseesecureview); [`Bugsee.startBlackout()` and `Bugsee.endBlackout()`](/sdk/flutter/privacy/video#blackout) (video, screenshot, touches and the view hierarchy stop; logs and data continue); the `captureVideo` and `captureScreenshot` options. | +| The Flutter widget tree (box and widget type name only: no text, labels, field values, keys, semantics or route names; a `BugseeSecureView` subtree is one node) | `captureViewHierarchy: false`. It is built only while the SDK is launched and the app is in the foreground. See [View hierarchy](/sdk/flutter/view-hierarchy). | +| `dart:io` network traffic (opt-in) | `installNetworkCapture` is never called by `launch`. `setNetworkFilter` runs first and **fails closed**; the native pipeline still runs after it (the app's native network filter if there is one, otherwise the SDK's default sanitizer). Text bodies only, up to `captureNetworkBodySizeLimit`. Requests to Bugsee itself are never recorded. See [Privacy: Network](/sdk/flutter/privacy/network). | +| `print` and `debugPrint` (opt-in) | `setLogFilter` (fails closed) and `captureLogsLevel`. **The SDKs have no log sanitizer.** See [Privacy: Console logs](/sdk/flutter/privacy/logs). | +| Lines you send with `Bugsee.log` | None. `Bugsee.log` bypasses `setLogFilter` and `captureLogsLevel`, and is recorded even when `captureLogs` is `false`. Remove sensitive data before the call. | +| Dart errors (exception text and stack) | The text is whatever your error says; a `FlutterError` contributes its summary only. The SDKs' filters do not apply to it. See [Crash and error reporting](/sdk/flutter/manual/crash-error-reporting). | +| Attributes, events, traces, breadcrumbs and the user identifier | What you pass. | +| Everything the SDK itself captures (device and OS information, SDK logs, touches, crashes) | The SDK's options. See [Configuration](/sdk/flutter/configuration). | + +| Page | Covers | +| --- | --- | +| [Video](/sdk/flutter/privacy/video) | `BugseeSecureView`, blackout, the video and screenshot options, and the Android startup hold. | +| [Console logs](/sdk/flutter/privacy/logs) | Turning log capture off, `captureLogsLevel`, `setLogFilter`, and the Android logcat echo. | +| [Network](/sdk/flutter/privacy/network) | Turning network capture off, body options, the SDK's redaction, `setNetworkFilter`, and the URL in Android HTTP breadcrumbs. | + +## Limits you need to know about + +- **Android logcat echo.** The SDK's own console capture records the same `print` again, raw, as source `LogCat` with the tag `flutter` (the `FlutterError` dump of a real app included), and **the Dart log filter does not apply to that echo**. On Android, add a native `Bugsee.setLogEventFilter` that drops `LogSource.LogCat` events tagged `flutter`. A debug build warns once. iOS recorded no echo on the simulator, and this was not verified on a physical device. See [Privacy: Console logs](/sdk/flutter/privacy/logs#the-android-logcat-echo). +- **Android HTTP breadcrumbs.** With `captureBreadcrumbs` on, the SDK records an `http` breadcrumb for each finished request with its URL. In the maintainers' measurement Android kept the query of the `http` breadcrumb URL; the SDK option documentation says the default sanitizer also redacts it; this was not re-measured at Android 7.6.0. Redact the URL in the network filter, which runs first. See [Privacy: Network](/sdk/flutter/privacy/network#http-breadcrumbs). +- **Secure views.** A region that has just appeared is recorded in the clear for its first frame or so. Pixels drawn outside a region's own subtree (an `Overlay` magnifier or tooltip) are not covered. Secure regions are verified in portrait on iOS only. See [Privacy: Video](/sdk/flutter/privacy/video#limits). +- **Nothing is recorded, and nothing is queued, before the SDK is launching or launched.** This applies to the logs, the network events and the view hierarchy. It also means filters protect only what is recorded after you install them. +- **Android startup.** The first seconds of a session are not recorded on Android, because the SDK holds capture until Flutter has drawn and published the secure regions. See [Privacy: Video](/sdk/flutter/privacy/video#android-startup-hold). +- **Install filters before `launch`.** A filter applies to what is recorded after it is set, so set the log and network filters at the top of `main`. + +Bugsee also sends data outside reports, such as notifications you send with `Bugsee.notify` and the messages of the [feedback chat](/sdk/flutter/feedback). Neither carries video or logs. + +It remains the responsibility of the application developer to keep sensitive data out of reports before they leave the device. diff --git a/docs/sdk/flutter/privacy/video.md b/docs/sdk/flutter/privacy/video.md index 0572fbcf..1a6654c3 100644 --- a/docs/sdk/flutter/privacy/video.md +++ b/docs/sdk/flutter/privacy/video.md @@ -1,51 +1,124 @@ --- -title: "Privacy and video" -description: "How to disable video recording or obscure sensitive Flutter views and screen regions to protect user privacy in recorded sessions." -sidebar_position: 1 +title: "Privacy: Video" +description: "How to keep sensitive screens out of the video and screenshots Bugsee Flutter SDK 10.x records: BugseeSecureView, blackout, the video and screenshot options, and the limits of each." +sidebar_position: 14 slug: "/sdk/flutter/privacy/video" --- -## Disabling video +:::warning[Beta] +This page documents Bugsee Flutter SDK **10.x**, which is in beta, is not published on pub.dev yet and can change between betas. The stable release is **9.x**: see the [9.x documentation](/sdk/flutter/v9/installation). Upgrading? See [Migrating from 9.x to 10.x](/sdk/flutter/migration). +::: -Video recording can be disabled completely using **videoEnabled** launch option. See [configuration](/sdk/flutter/configuration/) for more info. +Bugsee records the screen as a video and takes a screenshot when a report is made. A screen can show a card number, a password, a message or a medical record, so the SDK gives you three ways to keep it out: turn the recording off, hide a widget, or black out the whole screen for a sensitive flow. -## Blackout +## Disabling video and screenshots -You can temporarily black out the whole video and stop recording touch events, without stopping the rest of the data capture (logs, network, events): +Set `captureVideo` to `false` to record no video, and `captureScreenshot` to `false` to take no report screenshot: ```dart -// Black out the video -Bugsee.pause(); +import 'package:bugsee_flutter/bugsee_flutter.dart'; + +await Bugsee.launch( + 'YOUR_APP_TOKEN', + options: const BugseeOptions( + captureVideo: false, + captureScreenshot: false, + ), +); +``` + +## Hiding a widget: BugseeSecureView -// Resume normal video recording -Bugsee.resume(); +Wrap what must not be recorded in `BugseeSecureView`. The area the child occupies is blanked in the recorded video and in the report screenshot, and taps on it are dropped from the report. The user sees the child as usual. + +```dart +import 'package:bugsee_flutter/bugsee_flutter.dart'; +import 'package:flutter/material.dart'; + +Widget build(BuildContext context) => Column( + children: [ + const Text('Card number'), + // Blanked in the recorded video and in the report screenshot. + BugseeSecureView(child: TextField(obscureText: true)), + ], +); ``` -## Protecting flutter views +| Parameter | Type | Description | +| --- | --- | --- | +| `child` | `Widget` | Required. What to hide. | +| `enabled` | `bool` | Default `true`. `false` removes the redaction, and the child is recorded as usual. A disabled `BugseeSecureView` costs nothing. | -Bugsee automatically obscures ```TextField``` views with ```obscureText``` option set to true. Also, you can wrap any view sub-tree with ```BugseeSecureView``` to make it obscured on video. ```BugseeSecureView``` has ```enabled``` option for your convenience, thus you don't need to add/remove the element to toggle obscuring on/off. +The widget needs nothing to be set up. Where the child is (on screen, scrolled, transformed or animated) is measured every frame and handed to the SDK, which reads it a few times a second. A region that is moving is covered along its path. -## Protecting by coordinates +**It fails closed.** A region the plugin cannot place is covered whole: the entire display is blanked rather than guessed at. Only a view known to be off screen is left uncovered. -Bugsee allows hiding screen area by absolute coordinates as well: +`BugseeSecureView` hides the child from Bugsee's capture. It does not hide it from the user or from the operating system, and it does not set `FLAG_SECURE`. On Android, the `captureRespectFlagSecure` option (default `true`) makes the SDK treat an activity whose main window has `FLAG_SECURE` as a full-display blackout, so a window you secure yourself is covered as well. -> **Note:** BugseeSecureRect coordinates are in pixels, with origin (0,0) being the top left corner. +The [view hierarchy](/sdk/flutter/view-hierarchy#secure-views) records a `BugseeSecureView` as a single node, with no text and no children. -```dart -// Coordinates are: X, Y, Width, Height +### Limits + +- **A region that has just appeared is recorded in the clear for its first frame or so.** Dart can publish a region only after layout has placed it, so a newly mounted `BugseeSecureView` is not yet covered in its first frame. For something that must never be captured, keep the `BugseeSecureView` mounted and swap its content, instead of inserting the whole widget when the content appears. +- **Pixels drawn outside the region's own subtree are not covered.** An `Overlay` magnifier or tooltip, for example, is not part of the region. +- **A rotated region is covered by its bounding box**, and a partly clipped region is covered whole, so it can cover a few neighboring pixels. +- **Only the app's main view is placed on mobile.** +- **A hot-restarted isolate** that has no regions leaves the previous isolate's regions in place until the engine detaches. This happens in debug builds only and covers more, not less. +- **iOS is verified in portrait only.** Secure regions were verified on Android emulators at three screen densities and on iOS simulators; they were not verified on a physical device. +- A region with more than 2000 descendants is covered even when it is off screen. + +On Android, the SDK's own report screenshot captures Flutter's default `SurfaceView` from Android SDK 7.5.0, with the secure regions redacted. Earlier SDK versions produced a black screenshot. This release of the plugin uses Android SDK 7.6.0. + +## Android startup hold + +On Android the plugin turns on the SDK's startup hold (`com.bugsee.wrapper-hold`). From process start the SDK blacks out every display until the first Flutter frame is up and Dart has published the secure regions, about 750 ms after that frame. Without it, a secure view that is already on screen at startup would be recorded before Dart could say where it is. -// Add secure rectangle -Bugsee.addSecureRect(new Rectangle(20, 20, 100, 100)); +- **The first seconds of a session are not recorded on Android.** In a profile build the hold was released 3.8 seconds after process start, 1.3 seconds after the first frame. +- **Time caps bound the hold**: 10 seconds after the last Flutter engine that attached before a frame was displayed, 20 seconds after process start when none ever attached, and 60 seconds at most. A hold that a cap ends does not guarantee that Dart had published its secure regions. The cap is a safety limit, not a privacy guarantee. +- **It happens once per process.** A second engine, a hot restart or a relaunch is not held again. +- iOS has no such hold. -// Remove secure rectangle -Bugsee.removeSecureRect(new Rectangle(10, 10, 100, 100)); +You do not need to call anything to release the hold. -// Remove all rectangles -Bugsee.removeAllSecureRects(); +## Blackout + +`Bugsee.startBlackout()` stops recording everything that describes the screen, for as long as you need it: the video (black frames), the report screenshot, touch recording and the view hierarchy. Logs, network events, traces and the rest keep being captured. `Bugsee.endBlackout()` ends it, and `Bugsee.isBlackout()` tells whether one is in effect. -// Get all rectangles as BugseeSecureRect[] -dynamic rectangles = await Bugsee.getAllSecureRects(); +```dart +await Bugsee.startBlackout(); +try { + await showPaymentSheet(); +} finally { + await Bugsee.endBlackout(); +} ``` -You need to be aware of the orientation that can be changed while the app is running. -Recreate all rectangles after orientation change, if 'black box' on video does not cover all secure data that you need. \ No newline at end of file +- **There is no pause and no resume.** A blackout does not suspend the log or network capture. +- **You can call `startBlackout` before `launch`** on both platforms. Capture then starts blacked out, and `isBlackout` reflects it at once. +- **On Android a blackout lasts from launch to `stop`.** Stopping ends it, with a `BlackoutEnded` lifecycle event, and a later launch starts without one. A blackout requested while the SDK is stopping is handed to the next launch. +- **Network events keep recording.** A blackout does not hide a request from the network capture; use the [network filter](/sdk/flutter/privacy/network) for that. + +## Video and screenshot options + +| Option | Default | Platforms | Description | +| --- | --- | --- | --- | +| `captureVideo` | `true` | Both | Record video. | +| `captureScreenshot` | `true` | Both | Take the report screenshot. | +| `captureVideoScale` | `1.0` | Both | Additional down-scaling of the recorded video, between `0.1` and `1.0`. `0.5` halves the width and the height. | +| `captureScreenshotScale` | `1.0` | Both | Scales the screenshot down and back up before it is stored, which blurs fine detail while keeping the layout. **It is not a redaction control**: large, high-contrast text can stay readable. Use a secure view or blackout for anything sensitive. Clamped to `0.05` to `1.0`; `1.0` turns the effect off. | +| `captureViewHierarchy` | `true` | Both | Capture the view hierarchy. See [View hierarchy](/sdk/flutter/view-hierarchy). | +| `captureRespectFlagSecure` | `true` | Android | Treat a window with `FLAG_SECURE` as a full-display blackout. Independent of `startBlackout`. | +| `captureVideoPrivacyBlur` | `true` | iOS | Blur transition frames instead of skipping them. Off, the video freezes for the transition and never records it unprotected. | +| `captureVideoSecureScrolling` | `false` | Android | In video mode `v1`, skip more frames while secure views are on screen. | + +An option marked for one platform is skipped on the other, with a debug warning. See [Configuration](/sdk/flutter/configuration). + +## Password fields + +A Flutter `TextField` is drawn by Flutter, not as a native password control, and the plugin documents no automatic masking of Flutter text fields. Do not rely on `obscureText` to keep a field out of the video: wrap the field in `BugseeSecureView`. + +## Related pages + +- [Privacy overview](/sdk/flutter/privacy/overview) +- [View hierarchy](/sdk/flutter/view-hierarchy) +- [Lifecycle](/sdk/flutter/lifecycle): the `BlackoutEnded` event and the launch status. diff --git a/docs/sdk/flutter/release-notes.md b/docs/sdk/flutter/release-notes.md index 62c628b8..40f067ff 100644 --- a/docs/sdk/flutter/release-notes.md +++ b/docs/sdk/flutter/release-notes.md @@ -1,230 +1,63 @@ --- title: "Release notes" -description: "Changelog for the Bugsee Flutter SDK listing new features, bug fixes, and breaking changes for each released version." -sidebar_position: 11 +description: "Release history for Bugsee Flutter SDK 10.x (beta), with the native SDK versions each release is built on." +sidebar_position: 22 slug: "/sdk/flutter/release-notes" --- -## 9.0.4 (August 18 2026) -- Feat: Updated native SDKs to their latest versions (Android: [6.0.4](/sdk/android/v6/release-notes/#604-june-22-2026), iOS: [6.3.1](/sdk/ios/v6/release-notes/#631-july-31-2026)) +:::warning[Beta] +This page documents Bugsee Flutter SDK **10.x**, which is in beta, is not published on pub.dev yet and can change between betas. The stable release is **9.x**: see the [9.x documentation](/sdk/flutter/v9/installation). Upgrading? See [Migrating from 9.x to 10.x](/sdk/flutter/migration). +::: -## 9.0.3 (March 26 2026) -- Fix: Improper artifacts placement for iOS +Release history for Bugsee Flutter SDK 10.x: `bugsee_flutter` and `bugsee_flutter_feedback`, which are released together at the same version. Looking for the stable release? See the [9.x release notes](/sdk/flutter/v9/release-notes). Upgrading from 9.x? See the [migration guide](/sdk/flutter/migration). -## 9.0.2 (March 20 2026) -- Feat: Updated native SDKs to their latest versions (Android: [6.0.2](/sdk/android/v6/release-notes/#602-march-11-2026), iOS: [6.1.2](/sdk/ios/v6/release-notes/#612-march-4-2026)) +Each release lists the native SDKs it is built on. Their own changes are in the native SDK release notes: [Android](/sdk/android/release-notes) and [iOS](/sdk/ios/release-notes). -## 9.0.0 (March 6 2026) -- Feat: Updated native SDKs to their latest versions (Android: [6.0.0](/sdk/android/v6/release-notes/#600-december-9-2025), iOS: [6.1.2](/sdk/ios/v6/release-notes/#612-march-4-2026)) -- Breaking: \[iOS\] Minimum deployment target is iOS 12.0 -- Breaking: \[Android\] Bugsee SDK is now built with Android SDK version 35, hence requires compileSDKVersion 35 -- Breaking: \[Android\] AGP 8.6.0 or newer is now required +## 10.0.0-beta.1 (prerelease, not published yet) -## 8.6.9 (November 18 2025) -- Feat: Updated native SDKs to their latest versions (Android: [5.9.1](/sdk/android/v6/release-notes/#591-september-29-2025), iOS: [5.5.9](/sdk/ios/v6/release-notes/#559-november-17-2025)) +A rewrite for the Bugsee 7.x native SDKs (Android 7.6.0, iOS 7.1.0). **A prerelease, not published on pub.dev yet.** Existing 9.x apps should stay on 9.x: there is no compatibility layer: stay on 9.x or follow the migration guide. See [Migrating from 9.x to 10.x](/sdk/flutter/migration). -## 8.6.8 (October 15 2025) -- Feat: Updated native SDKs to their latest versions (Android: [5.9.1](/sdk/android/v6/release-notes/#591-september-29-2025), iOS: [5.5.8](/sdk/ios/v6/release-notes/#558-august-21-2025)) +**Features** -## 8.6.7 (September 23 2025) -- Feat: Updated native SDKs to their latest versions (Android: [5.8.7](/sdk/android/v6/release-notes/#587-september-9-2025), iOS: [5.5.8](/sdk/ios/v6/release-notes/#558-august-21-2025)) +- **Launch and configuration.** `Bugsee.launch(token, {options})` returns a `LaunchResult` (`launched`, `alreadyRunning`, `deferred`). Also `waitUntilLaunched`, `stop`, `status`, `statusChanges`, `getStatus`, `isLaunched`, `getLaunchOptions` and `getHostLaunchOptions`. `BugseeOptions` has a typed, documented field for each of the 100 options the SDKs register, generated from the manifests they publish; an unknown key or a wrong type is an `ArgumentError` before the SDK sees it. See [Lifecycle & status](/sdk/flutter/lifecycle) and [Configuration](/sdk/flutter/configuration). +- **Data.** Attributes (`setAttribute`, `getAttribute`, `getAllAttributes`, `clearAttribute`, `clearAllAttributes`), the user identifier, `event`, `trace`, `log`, `addBreadcrumb`, `notify`, blackout (`startBlackout`, `endBlackout`, `isBlackout`), `showReportDialog` and `upload`. See [Custom events & traces](/sdk/flutter/events-and-traces) and [User & session data](/sdk/flutter/user-session-data). +- **Reports.** `setReportHandler` with `ReportProxy` (before and after callbacks, edits to summary, description, severity, labels and attributes), report attachments and annotated screenshots (path-first, `addAttachmentBytes` up to 1 MiB), `Bugsee.createReport` returning a `CreatedReport`, and the `lifecycleEvents` stream. See [Report handler](/sdk/flutter/report-handler). +- **Privacy.** The `BugseeSecureView` widget, and the Flutter widget tree in reports (boxes and type names only, no text, keys or semantics; a secure view is one node), plus `Bugsee.captureViewHierarchy()`. See [Privacy](/sdk/flutter/privacy/overview) and [View hierarchy](/sdk/flutter/view-hierarchy). +- **Dart errors.** `logException`, `logUnhandledException` and `reportException`. Opt-in `installErrorHandlers` (chained, restored, once per error, rate limited, **error reports by default**, `reportAsCrash: true` for crash reports), `errorHandlersActive`, `runGuarded` and `listenToIsolateErrors`. Obfuscated (`--split-debug-info`) stacks are sent untouched for the backend to symbolicate. See [Dart errors](/sdk/flutter/dart-errors). +- **Network.** Opt-in `installNetworkCapture` records `dart:io` HTTP traffic (`package:http`, the default adapter of `dio`, `Image.network` and others) and hands it to the SDK with the SDK's body options and sanitizer. `setNetworkFilter` is a Dart-side, fail-closed filter that runs first. `networkCaptureStats`. See [Network capture](/sdk/flutter/network). +- **Logs.** Opt-in `installLogCapture` records `print` (in a zone: `runWithLogCapture`, `runGuarded`) and `debugPrint`; `forwardLog` for your own logging; `setLogFilter` (fail closed); `logCaptureStats`. Lines are recorded with the plugin's own source (`Custom`), not as `Bugsee.log`. See [Console logs](/sdk/flutter/logs). +- `bugseeFlutterVersion`, so the feedback package can check it runs with the core it was released with. +- The in-app feedback chat is the separate package `bugsee_flutter_feedback`, released in lock-step. See [Feedback](/sdk/flutter/feedback). +- The wrapper registers with the SDK before it can launch (an Android content provider; iOS at load time), so reports recovered after a crash carry the wrapper identity. -## 8.6.6 (August 21 2025) -- Feat: Updated native SDKs to their latest versions (Android: [5.8.4](/sdk/android/v6/release-notes/#584-august-21-2025), iOS: [5.5.8](/sdk/ios/v6/release-notes/#558-august-21-2025)) +**Breaking changes from 9.x** -## 8.6.5 (June 12 2025) -- Feat: Updated native SDKs to their latest versions (Android: [5.7.5](/sdk/android/v6/release-notes/#575-june-8-2025), iOS: [5.5.6](/sdk/ios/v6/release-notes/#556-march-25-2025)) -- Fix: \[Android\] In some configurations, application may crash on device with 16KB memory pages +- A new API: `Bugsee.launch` returns `LaunchResult` and takes `BugseeOptions` (no `AndroidLaunchOptions` or `IOSLaunchOptions`, no `appRunCallback`). The email becomes the user identifier. Attachments move to the report handler. Secure rectangles are replaced by `BugseeSecureView`. `pause` and `resume` are replaced by blackout. `relaunch`, the appearance system, `setApplicationVersion`, `registerNetworkEvent`, `BugseeIgnoreSecureView` and the test-crash calls are removed. Network, log and error capture are opt-in. The full mapping is in [Migrating from 9.x to 10.x](/sdk/flutter/migration). +- The Dart log, network and lifecycle types are new: `BugseeLogEvent.message` instead of `text`, `LifecycleEvent` instead of `BugseeLifecycleEventType`, `ReportSeverity` instead of `BugseeSeverityLevel`. -## 8.6.4 (May 6 2025) -- Feat: Updated native SDKs to their latest versions (Android: [5.7.3](/sdk/android/v6/release-notes/#573-may-5-2025), iOS: [5.5.6](/sdk/ios/v6/release-notes/#556-march-25-2025)) +**Other changes** -## 8.6.3 (March 17 2025) -- Feat: Updated native SDKs to their latest versions (Android: [5.7.2](/sdk/android/v6/release-notes/#572-march-17-2025), iOS: [5.5.5](/sdk/ios/v6/release-notes/#555-february-13-2025)) +- Log lines keep the time they were printed on both platforms: a line that a slow filter or a long queue delayed is no longer recorded late. +- With Android SDK 7.5.0 and later, the report screenshot captures Flutter's default `SurfaceView`, with the secure views redacted. On an older Android SDK the screenshot was black. -## 8.6.0 - 8.6.2 (March 10 2025) -- Feat: Updated native SDKs to their latest versions (Android: [5.7.1](/sdk/android/v6/release-notes/#571-march-4-2025), iOS: [5.5.5](/sdk/ios/v6/release-notes/#555-february-13-2025)) -- Feat: Swift Package Manager support added +**Requirements** -## 8.5.0 (February 20 2025) -- Feat: Full Flutter 3.29 support -- Feat: Updated native SDKs to their latest versions (Android: [5.7.0](/sdk/android/v6/release-notes/#570-february-12-2025), iOS: [5.5.5](/sdk/ios/v6/release-notes/#555-february-13-2025)) +- Flutter 3.50.0 or later, Dart 3.14 or later. The 10.0 major moves the floor to the release with Direct Interop, Android Gradle Plugin 9 and `material_ui`. +- Android: `minSdk` 21, JDK 17 or 21, and the Bugsee Gradle plugin 4.1.1 applied by your app (mandatory). Turn on the native symbol upload with `bugsee { ndk { enabled.set(true) } }`: the plugin has it off, and without it native crashes in release builds are unreadable. See [Installation](/sdk/flutter/installation#android). +- Android: the SDK's startup hold is on, so capture is blacked out from process start until the first Flutter frame is up and the secure views are published (about one second after the frame). The first seconds of a session are not recorded. Time caps bound the hold (10 seconds after the last engine that attached before a frame, 20 seconds with none, 60 seconds at most); a cap is a safety limit, not a privacy guarantee. +- iOS: 15.0 or later, Swift Package Manager only (no CocoaPods). -## 8.4.3 (February 4 2025) -- Feat: Updated native SDKs to their latest versions (Android: [5.6.5](/sdk/android/v6/release-notes/#565-february-3-2025), iOS: [5.5.4](/sdk/ios/v6/release-notes/#554-january-27-2025)) -- Fix: \[Android\] Built-in UI shifts upwards in some scenarios on Android 15 (specifically, when hosting application itself is targeting Android 15, i.e. target SDK version is 35) +**Compatibility** -## 8.4.2 (November 23 2024) -- Feat: Updated native SDKs to their latest versions (Android: 5.6.5, iOS: 5.5.4) +- Android: Bugsee Android SDK 7.6.0, Bugsee Gradle plugin 4.1.1. +- iOS: Bugsee iOS SDK 7.1.0. -## 8.4.1 (November 20 2024) -- Feat: Internal improvements +### Known limitations -## 8.4.0 (September 12 2024) -- Feat: Updated native SDKs to their latest versions (Android: 5.4.2, iOS: 5.3.2) -- Feat: \[Android\] Add support for 16KB memory pages -- Fix: \[Android\] Crash when bug is sent from built-in reporting UI after removing screenshot +- Verification is on Android emulators and iOS simulators, plus integration tests on one physical Android 14 phone, an iPhone XS and an iPhone 16 Pro. On the phones some tests failed or were not run: the view hierarchy test fails on the debug builds of the Android phone and the iPhone XS and passes in profile builds, and the iPhone 16 Pro ran only the attachments, network and logs tests. +- The iOS crash matrix ran on an iPhone XS: recovered reports of native signals, Objective-C exceptions and a Swift trap. A raised signal 7 (`SIGEMT` on iOS, not `SIGBUS`) leaves no report, and `SIGBUS` is not measured on a device. The iOS paths for Dart exceptions were not run on a phone. +- The iOS simulator slice has no crash reporter and files no logged exceptions, so crash recovery and Dart error reports cannot be tried on a simulator. +- Not exposed: APM transactions and spans, the appearance system, `relaunch`. +- Secure views do not cover the first frame of a region that has just appeared. See [Privacy: Video](/sdk/flutter/privacy/video). -## 8.3.0 (August 5 2024) -- Feat: Improved Isolate errors handling and corresponding new APIs - -## 8.2.1 (April 24 2024) -- Fix: Use SDK version 34 for Android build - -## 8.2.0 (April 22 2024) -- Fix: More reliable stack trace capture -- Feat: MonitorDiskSpace launch option is added - -## 8.1.0 (April 19 2024) -- Fix: \[Android\] In some cases, video before FG->BG->FG transitions may be absent -- Note: \[Android\] compileSdkVersion 34 and up is now required - -## 8.0.2 (April 11 2024) -- Feat: Updated dependencies to their latest versions (Android: 4.2.4, iOS: 5.0.2) - -## 8.0.1 (April 11 2024) -- Feat: Updated dependencies to their latest versions (Android: 4.2.4, iOS: 5.0.0) - -## 8.0.0 (January 15 2024) -- Feat: Updated dependencies to their latest versions -- Breaking: Minimal supported Dart SDK version is now 3.0.0 - -## 7.0.0 (December 25 2023) -- Feat: Updated native SDKs to their latest versions (Android: 4.2.1, iOS: 5.0.0) -- Breaking: \[iOS\] Bitcode is not present in the resulting binaries any more - -## 6.1.0 (December 6 2023) -- Feat: Updated native SDKs to their latest versions (Android: 4.2.1, iOS: 4.1.0) - -## 6.0.1 (October 2 2023) -- Feat: Updated native SDKs to their latest versions (Android: [4.0.1](/sdk/android/v6/release-notes/#401-september-30-2023), iOS: [4.0.1](/sdk/ios/v6/release-notes/#401-september-30-2023)) - -## 6.0.0 (September 25 2023) -- Feat: Updated native SDKs to their latest versions (Android: 4.0.0, iOS: 4.0.0) -- Feat: Full compatibility with iOS 17.0 and Android 14 -- Breaking: \[iOS\] Minimum deployment target is iOS 11.0 (was 9.0) -- Breaking: \[iOS\] ARMv7 is not supported any more. -- Breaking: \[Android\] Bugsee SDK is build against Gradle 7.5, AGP 7.4.2 -- Breaking: \[Android\] Bugsee SDK is build with targetSdk and compileSdk of version 33 - -## 5.4.0 (August 31 2023) -- Feat: Updated native SDKs to their latest versions (Android: 3.10.0, iOS: 3.8.0) -- Feat: Add new API to manually trigger view hierarchy capturing. Multiple view hierarchies support. - -## 5.3.2 (August 17 2023) -- Fix: Build on iOS may fail due to invalid methods' signatures - -## 5.3.1 (July 12 2023) -- Feat: Updated native SDKs to their latest versions (Android: 3.8.2, iOS: 3.7.1) -- Fix: \[Android\] In some circumstances crashes may not be reported - -## 5.3.0 (June 6 2023) -- Feature: Update native SDKs to the latest versions (Android: 3.8.1, iOS: 3.6.0) -- Feature: Improved backward compatibility with upcoming versions of Flutter and Dart - -## 5.2.0 (April 24 2023) -- Feature: Update native Android SDK to the latest version 3.7.0 -- Feature: Improved interaction with the WebView. Now it's stable and captures more network requests. - -## 5.1.0 (April 6 2023) -- Feature: Update native SDKs to the latest versions (Android: 3.6.0, iOS: 3.5.0) -- Feature: Ability to change placeholders for the input fields in the built-in bug reporting UI - -## 5.0.5 (March 8 2023) -- Fix: Incorrect underlying Bugsee Android SDK was used. Now using (Android: 3.4.0, iOS: 3.3.3) - -## 5.0.4 (February 26 2023) -- Feature: Updated native SDKs to their latest versions - -## 5.0.3 (January 26 2023) -- Feature: Updated native SDKs to their latest versions - -## 5.0.2 (November 24 2022) -- Feature: Update native SDKs to the latest versions (Android: 3.0.2, iOS: 3.2.1) -- Fix: Properly specify fallback value for 'compileSdkVersion' - -## 5.0.1 (October 26 2022) -- Feature: Update native SDKs to the latest versions (Android: 3.0.0, iOS: 3.1.2) -- Fix: Secure rectangles serialization/deserialization issues - -## 5.0.0 (October 14 2022) -- Breaking: Support for Flutter 2.X and earlier is dropped. Only Flutter 3.0 and up is now supported -- Fix: Exception may be thrown when showReportDialog() and upload() is called with no data - -## 4.0.0 (September 6 2022) -- Fix: Properly intercept and filter network requests made from native code -- Feature: Update native SDKs to the latest versions (Android: 3.0.0, iOS: 3.0.0) -- Note: Please refer to the underlying SDKs release notes to get the detailed list of changes: [Android](/sdk/android/v6/release-notes/#300-august-19-2022) / [iOS](/sdk/ios/v6/release-notes/#300-september-1-2022) - -## 3.1.0 (July 8 2022) -- Feat: Update public method types and improve code style - -## 3.0.3 (May 30 2022) -- Feat: Update underlying SDKs to their latest versions (several race conditions were fixed) - -## 3.0.2 (May 23 2022) -- Feat: Add missing parts (example and pubspec fields) to pub.dev package - -## 3.0.1 (May 16 2022) -- Feat: Flutter 3 support - -## 2.1.2 (April 18 2022) -- Feat: Update underlying SDKs to their latest versions -- Feat: View hierarchy now captures more data for each node - -## 2.1.1 (April 8 2022) -- Fix: Add missing required components for view hierarchy capturing - -## 2.1.0 (April 7 2022) -- Feat: View hierarchy is now also captured for the Flutter widget tree - -## 2.0.0 (March 7 2022) -- Feat: Update underlying SDKs to their latest versions -- Fix: iOS SDK does not require cleanup script any more -- Feat: Secure views are now automatically obscured on video -- Breaking change: Underlying Bugsee Android SDK is now fully migrated to AndroidX - -## 1.3.1 (January 17 2022) -- Fix: Add missing NotificationBarTrigger launch option for Android -- Feat: Update dependencies to their latest versions - -## 1.3.0 (December 16 2021) -- Fix: In some rare cases not all crash reports may be sent to the server upon next relaunch \[iOS\] - -## 1.2.0 (November 14 2021) -- Feat: Make Bugsee Flutter SDK compatible with Flutter pre-2.5 - -## 1.1.1 (November 9 2021) -- Fix: Properly intercept all console logs -- Fix: Do not block/hang when Bugsee is launched from background app - -## 1.1.0 (October 4 2021) -- Feat: Update native SDKs to their latest versions -- Feat: Make SDK compatible and fully functional on iOS 15 and Android 12 - -## 1.0.8 (September 17 2021) -- Fix: Make code compatible with Flutter 2.5 - -## 1.0.7 (August 9 2021) -- Fix: Build failure with CocoaPods 1.10.2 - -## 1.0.6 (July 25 2021) -- Fix: Previous deployment ended up with inconsistent versions. This follow up release fixes it - -## 1.0.5 (July 25 2021) -- Fix: Properly populate versions for Bugsee Flutter wrapper and native Bugsee SDKs - -## 1.0.4 (July 18 2021) -- Fix: Properly handle exceptions with empty stack traces - -## 1.0.3 (July 10 2021) -- Fix: Add missing checks in the Android bridging module - -## 1.0.2 (July 6 2021) -- Fix: Fixing iOS build failure in some environments - -## 1.0.1 (June 28 2021) -- Fix: Network events interception and filtering - -## 1.0.0 (May 25 2021) -- Initial release +For the previous stable line, see the [9.x release notes](/sdk/flutter/v9/release-notes). diff --git a/docs/sdk/flutter/report-handler.md b/docs/sdk/flutter/report-handler.md new file mode 100644 index 00000000..a9a70d94 --- /dev/null +++ b/docs/sdk/flutter/report-handler.md @@ -0,0 +1,178 @@ +--- +title: "Report handler" +description: "Inspect or enrich every report before Bugsee Flutter SDK 10.x sends it: setReportHandler, its two callbacks, ReportProxy edits, the time window, ReportClosedError, attachments and screenshots." +sidebar_position: 7 +slug: "/sdk/flutter/report-handler" +--- + +:::warning[Beta] +This page documents Bugsee Flutter SDK **10.x**, which is in beta, is not published on pub.dev yet and can change between betas. The stable release is **9.x**: see the [9.x documentation](/sdk/flutter/v9/installation). Upgrading? See [Migrating from 9.x to 10.x](/sdk/flutter/migration). +::: + +A **report handler** is the one place to inspect or change a report before Bugsee sends it. It sees the reports that reach Dart: bug reports from the dialog or from `upload`, error reports, and crash reports when the SDK hands them to Dart (see [Limits](#limits)). Use it for anything that must apply to all of them: labels, attributes, a severity rule, a config snapshot as an attachment. + +```dart +import 'package:bugsee_flutter/bugsee_flutter.dart'; + +Future main() async { + await Bugsee.setReportHandler( + BugseeReportHandler( + onAfterReportCreated: (report) async { + await report.replaceLabels(['beta-build']); + await report.setAttribute('screen', 'cart'); + }, + ), + ); + await Bugsee.launch(''); +} +``` + +## Install it before launch + +Call `Bugsee.setReportHandler` **before** `Bugsee.launch`. During launch the SDK recovers reports from the previous run, such as a crash, and a handler installed afterwards misses them. The registration is stored natively, so it works before launch. + +- There is one handler at a time. A later call replaces it. `setReportHandler(null)`, or a handler with neither callback, clears it, and then the SDK is never kept waiting for Dart. `Bugsee.reportHandler` reads the current one back. +- A phase you leave out is not delivered to Dart at all. +- If your handler throws, the error is reported through `FlutterError.reportError` and the report still goes on. +- Reports the SDK recovers before the Flutter engine exists cannot reach Dart (see [Limits](#limits)). + +## The two callbacks + +| Callback | When it runs | Delivered | +| --- | --- | --- | +| `onBeforeReportCreated(report)` | Before the report is built. For the dialog, before it opens. | **At most once** per report, and may be skipped. | +| `onAfterReportCreated(report)` | After the report is built, before it is sent. | **At least once**: it can run again, in a later process, for a report that already carries the first run's changes (a recovered crash is one). | + +Within one run of the app a repeat of the same report and phase is not delivered again. The id is recorded before the handler runs, so a handler that threw or overran counts as delivered and is not retried in that process; the SDK's own redelivery after a crash is the retry, in a later process. + +Because `onAfterReportCreated` can run more than once, make it **idempotent**: running it twice must leave the report as running it once would. Set values rather than append them (`replaceLabels`, not `addLabels`; `setAttribute` replaces a value of the same name), and read `report.read()` before adding an attachment that an earlier run may already have added. + +Each callback receives a `ReportProxy` and may be async (`FutureOr`). + +### Which call triggers which callback + +| Call | `onBeforeReportCreated` | `onAfterReportCreated` | +| --- | --- | --- | +| `showReportDialog` | Before the dialog opens, so it does not see what the user types. | After the report is built from what the user sent. | +| `upload`, `logException`, installed error handlers | Before the report is built. | After it is built. | +| Crashes | May be skipped. | Depends on the platform and the kind of crash; see [Limits](#limits). | +| `createReport` on Android | Inside `createReport()`. | At the created report's `upload()`. | +| `createReport` on iOS | At `upload()`. | At `upload()`. Both run after the created report's fields are applied, so a handler's `replaceLabels` replaces the labels you set. | + +To act on what a user typed into the dialog, such as redacting it, use `onAfterReportCreated`. Redaction in a handler is best-effort: if the callback throws or runs past its time window, the SDK sends the report as it is. Where redaction must be guaranteed, sanitize the text before it is submitted. + +## The report object + +`ReportProxy` is a handle on the live report, not a copy. + +| Member | Notes | +| --- | --- | +| `id`, `type`, `typeName` | The SDK's report id (stable across a re-delivery) and its type: `ReportType.bug`, `crash` or `error` (`type` is `null` for a type this version does not know). | +| `deliveryId` | Stable for this report and phase. Two deliveries with the same `deliveryId` are the same report being handled again: use it to de-duplicate side effects outside the report (for example, a call to your own backend). | +| `isLive` | Whether edits can still reach the SDK. | +| `read()` | A `ReportSnapshot` now (a value, not live): `id`, `type`, `summary`, `description`, `email`, `severity`, `labels`, `attributes`, `attachments`, `screenshots`. | +| `setSummary`, `setDescription`, `setEmail`, `setSeverity` | Set a field. | +| `replaceLabels`, `addLabels`, `clearLabels` | `replaceLabels` replaces all labels in one atomic step and is the idempotent way. | +| `setAttribute`, `removeAttribute`, `clearAttributes` | Attributes of this report. The value must be a `String`, `bool`, `int` or finite `double`; anything else is an `ArgumentError` and nothing is sent. | +| `addAttachment`, `addAttachmentBytes`, `clearAttachments`, `setScreenshot`, `removeScreenshot` | See [Attachments and screenshots](#attachments-and-screenshots). | + +```dart +await Bugsee.setReportHandler( + BugseeReportHandler( + onBeforeReportCreated: (report) async { + if (report.type == ReportType.error) { + await report.setSeverity(ReportSeverity.medium); + } + }, + onAfterReportCreated: (report) async { + final snapshot = await report.read(); + if (snapshot.type == ReportType.crash) { + await report.replaceLabels([...snapshot.labels, 'crash-triage']); + } + }, + ), +); +``` + +## Await every edit + +Every operation on `ReportProxy` crosses to native, so it is asynchronous, and the report goes back to the SDK when your callback returns. **Await every edit before returning.** An edit that starts after the report is handed back throws `ReportClosedError` and changes nothing; the same error is thrown for an edit after the time window closed. + +`ReportClosedError` extends `StateError`; a created report that was uploaded, discarded or expired throws its subclass `CreatedReportClosedError`. + +## The time window + +The SDK gives a handler a fixed budget and moves on when it runs out. The SDK's budget is 30 seconds per handler on iOS and, on Android, the `configReportHandlerCallbackTimeout` option (default 30; 0 or below means the 20 second default). The wrapper's window is that budget less a third, with at most 10 seconds of margin, and never more than 20 seconds: + +| Situation | The SDK's budget | The window you get | +| --- | --- | --- | +| A live report (dialog, `upload`, error, a crash recovered after a normal session) | 30 seconds per handler by default | 20 seconds | +| iOS recovery of a previous run's report | 3 seconds | 2 seconds | + +Do slow work **before** the edit calls and keep the callback short. The SDK's own limit for a whole chain of handlers is 60 seconds. The wrapper's pipeline never blocks the SDK: it completes the SDK's callback exactly once on every path (when you return, when the window ends, or at once when nothing is registered or Dart cannot run). + +## Attachments and screenshots + +Attachments and screenshots are **path-first**: you give a file path, and native copies, moves or decodes the file. The file never crosses to Dart as bytes. `addAttachmentBytes` is the convenience for a small payload. + +```dart +import 'dart:io'; +import 'dart:typed_data'; + +Future attach(ReportProxy report, File log, File drawing) async { + // Copies the file (the default) + await report.addAttachment(log.path, name: 'app-log', mimeType: 'text/plain'); + + // Consumes a temporary file you were about to delete + await report.addAttachment('/path/to/tmp.json', name: 'state', mimeType: 'application/json', move: true); + + // Small payloads only + await report.addAttachmentBytes(Uint8List.fromList([104, 105]), name: 'note'); + + // An annotated screenshot for display 0 + await report.setScreenshot(drawing.path, annotated: true); +} +``` + +| Member | Notes | +| --- | --- | +| `addAttachment(path, {required name, mimeType, move = false})` | Adds the file at `path`. | +| `addAttachmentBytes(bytes, {required name, mimeType})` | At most 1 MiB. Empty data is valid for a handler report. | +| `clearAttachments()` | Removes every attachment, including ones the SDK or an earlier handler added, and deletes their files. | +| `setScreenshot(path, {displayId = 0, annotated = false})` | Replaces the screenshot of that display. Set `annotated` when the picture carries a drawing. | +| `removeScreenshot({displayId = 0})` | Does nothing when there is none. | + +Rules: + +- **Path.** An absolute file system path (`File.path`). A URL (`file:`, `content:`), a relative path, a path with control characters or one over 4096 units is a `BugseeArgumentException`. The OS decides what is readable: the app's own directories always are; on Android 10 and newer a path in shared storage is usually `unreadable` or `fileNotFound`. +- **Name and type.** `name` is 1 to 255 characters, not blank, with no control characters and no `/` or `\`. `mimeType` is `null` or `type/subtype` without parameters. +- **Copy and move.** A copy leaves the source. A move consumes it once the SDK accepted the file; a refused move never consumes the file. A symbolic link is copied by content, and with `move` only the link is removed. Do not delete your own file after a move. +- **Limits.** A file may be at most 20 MiB (`maxAttachmentFileBytes`), bytes at most 1 MiB (`maxAttachmentBytes`), a report holds at most 1000 attachments, and an image at most 4096 x 4096 pixels (`maxScreenshotPixels`, checked from the file header before any pixel is decoded). PNG and JPEG are the usual formats; whatever the platform decodes is accepted. +- **Threads.** File work runs on a background worker in call order, never on the platform thread. A request queued behind 64 others answers `busy`. +- **Orientation.** A JPEG with an orientation flag in its metadata is stored not rotated on Android and rotated on iOS. Normalize the picture first if that matters. +- **Annotated screenshots.** Without `annotated: true` the screenshot is stored as not annotated, which on a report that has a video the viewer does not offer over the video. + +A refused file throws `ReportAttachmentException` and changes nothing, the source included. Its `reason` is a `ReportAttachmentFailure`: + +| Reason | Meaning | +| --- | --- | +| `fileNotFound`, `notAFile`, `unreadable` | No file at the path, not a regular file, or not readable by this process. | +| `tooLarge` | Over the size limits above. | +| `limitReached` | The report holds as many attachments as it may. | +| `rejected` | The SDK declined (the report no longer accepts attachments, no storage, a full disk). The source is untouched. | +| `busy` | The file worker's queue is full. Try again. | +| `unsupported` | The platform cannot do it (an annotated screenshot on an iOS created report). | +| `imageUndecodable`, `imageTooLarge` | Not an image the platform decodes, or over the pixel limit. | + +### Late attachments + +The SDK's own timer does not wait for a copy that is still running. An attachment call that outlives the window is refused with `rejected` and the source file is left in place. A call made after the report was handed back is a `ReportClosedError`. Note that `setScreenshot` and `clearAttachments` cannot be undone once they started inside the window, so await them promptly. + +## Limits + +- **Before the engine exists.** A report recovered while no Flutter engine is attached cannot reach Dart (this includes recovery at an early launch and Android auto-init). With an engine attached, iOS recovery gives Dart 2 seconds. Not verified on a device. +- **Terminating.** Neither callback runs while the process is terminating, because Dart cannot run then. `isTerminating` is never passed to Dart. +- **Android native crash recovered after a normal session.** The report is dispatched on the SDK's report handler thread with the live window; Dart runs and its attribute, label and file land in the recovered report (device-measured). +- **A late edit can still be accepted.** The SDK starts its timer when it queues the handler, the wrapper's window starts when the handler is entered. The margin absorbs that wait; an edit after the SDK moved on is not always refused. +- **Several engines.** The most recently attached one that has a handler gets the delivery. +- **Hot restart.** A hot restart starts a new Dart isolate; calling `setReportHandler` in `main` registers the handler again on every start. diff --git a/docs/sdk/flutter/symbolication/android.mdx b/docs/sdk/flutter/symbolication/android.mdx new file mode 100644 index 00000000..e22bd899 --- /dev/null +++ b/docs/sdk/flutter/symbolication/android.mdx @@ -0,0 +1,69 @@ +--- +title: "Symbolication: Android" +description: "Uploading the R8 mapping and the native symbols of a Flutter 10.x Android release build with the Bugsee Gradle plugin, and how to turn the native upload on." +sidebar_position: 19 +slug: "/sdk/flutter/symbolication/android" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +:::warning[Beta] +This page documents Bugsee Flutter SDK **10.x**, which is in beta, is not published on pub.dev yet and can change between betas. The stable release is **9.x**: see the [9.x documentation](/sdk/flutter/v9/installation). Upgrading? See [Migrating from 9.x to 10.x](/sdk/flutter/migration). +::: + +An Android release build needs two uploads for readable reports, and both come from the Bugsee Gradle plugin that the app applies (see [Installation](/sdk/flutter/installation)). The plugin is mandatory for the 7.x SDK, version 4.1.1 is the one this release is tested with. [Symbolication overview](/sdk/flutter/symbolication/overview) explains what each upload is for. The Dart frames are a separate, manual upload: see [Symbolication: Dart](/sdk/flutter/symbolication/dart). + +| What | Setting | Needs the app token | +| --- | --- | --- | +| R8/ProGuard mapping | None. Uploaded on every minified build by `uploadMapping`. | Yes | +| Native symbols (`libflutter.so`, your `.so` files) | `bugsee { ndk { enabled.set(true) } }`. Off by default. | Yes | + +## The app token + +The plugin reads your Android app token from one of these places: + +- `bugsee.properties` in the Gradle root directory, which for a Flutter app is the `android/` folder. +- `appToken("...")` in the `bugsee { }` block. + +Without a token the upload tasks skip quietly, so a green build does not prove that anything was uploaded. + +## Native symbols + +A crash in `libflutter.so` or in any other `.so` is readable, with function and file:line, only when Bugsee has the native symbols of that build. The native crash detector is always part of the app, because the plugin depends on the separate `bugsee-android-ndk` artifact. The symbol upload is not: turn it on in `android/app/build.gradle.kts`. + + + + +```kotlin title="android/app/build.gradle.kts" +bugsee { + ndk { enabled.set(true) } +} +``` + + + + +```groovy title="android/app/build.gradle" +bugsee { + ndk { enabled.set(true) } +} +``` + + + + +With it on, the plugin uploads the unstripped libraries of every **non-debuggable** build, with a task named `uploadNative`, for example `uploadBugseeReleaseNative`. A debug build uploads nothing. + +:::note +Without `ndk.enabled`, native crashes in release builds are recorded but stay unreadable. This is the one setting a Flutter app is most likely to miss, because the plugin has it off. +::: + +## Build requirements + +- JDK 17 or 21. JDK 25 is not part of the supported set. +- Bugsee Gradle plugin 4.1.1. An older plugin fails Gradle task validation on `injectBugseeBuildId` (4.1.0 fixed it), and a plugin older than 4.0.7 breaks extension registration. + +## Check that the upload happened + +Run a release build and read the Gradle output for the `uploadMapping` task and, with the native upload on, `uploadNative`. If the native task is missing, `ndk.enabled` is not set. The native crash detector must also be on the classpath: `./gradlew :app:dependencies | grep bugsee-android-ndk`. The general Android side is described in [Android crashes](/sdk/android/issue-detection/crashes). diff --git a/docs/sdk/flutter/symbolication/dart.md b/docs/sdk/flutter/symbolication/dart.md new file mode 100644 index 00000000..1ac3fa2b --- /dev/null +++ b/docs/sdk/flutter/symbolication/dart.md @@ -0,0 +1,71 @@ +--- +title: "Symbolication: Dart" +description: "How Dart frames of a Flutter 10.x release build made with --split-debug-info and --obfuscate are sent, how to upload the symbols files, and exactly what is verified." +sidebar_position: 21 +slug: "/sdk/flutter/symbolication/dart" +--- + +:::warning[Beta] +This page documents Bugsee Flutter SDK **10.x**, which is in beta, is not published on pub.dev yet and can change between betas. The stable release is **9.x**: see the [9.x documentation](/sdk/flutter/v9/installation). Upgrading? See [Migrating from 9.x to 10.x](/sdk/flutter/migration). +::: + +A Dart error from a debug build carries a readable stack. A release build made with `--split-debug-info`, with or without `--obfuscate`, does not: the stack is in the VM's non-symbolic format, and Bugsee needs the symbols file that the build wrote. + +## What the SDK sends + +With `--split-debug-info` the VM prints a stack as a header (`build_id: '...'` and the snapshot base addresses) followed by one `#NN` line per frame with addresses. The plugin sends that text unchanged, as the stack of the error. It never rewrites it: the backend reads the build ID from the header, looks up the symbols you uploaded for that build, and decodes the frames. A stack longer than 64 KiB is cut at a line boundary, header first. + +`--obfuscate` also renames classes. A custom exception type is then named from its message when the message starts with `Name:`, the convention of `Exception.toString`. Otherwise the report shows the obfuscated type name. The stack is symbolicated either way. + +## Build with symbols + +```sh +flutter build apk --release --obfuscate --split-debug-info=build/symbols +``` + +`ios` and `appbundle` work the same way. The `build/symbols` folder gets one `.symbols` file per architecture and platform. Keep it, with the rest of the debug files, for every build you ship: the build ID ties a stack to its file. The folder holds your build machine's paths, so do not commit it. + +## Upload the symbols + +The upload is manual. Nothing in a Flutter build calls the Bugsee uploader, the plugin ships none, and `bugsee-cli` has no Flutter type yet (its `--type elf` is for native libraries). + +The script the 9.x plugin used still produces the upload the backend accepts. The script needs Python 3 with the `requests` package (`python3 -m pip install requests`); without it the command stops with `ModuleNotFoundError` before uploading. Run it after the build, in the project folder, pinned to a fixed commit and checked against its checksum: + +```sh +curl -fsSL https://raw.githubusercontent.com/bugsee/bugsee-flutter/9bc0f8645755114491235dc68fec84fdc5671755/scripts/symbols.py -o symbols.py \ + && echo "ef2ed4c25b87da764fd5b70238a41d776f6aa88b5e3174faa4e33de2f08453f7 symbols.py" | shasum -a 256 -c - \ + && python3 symbols.py -t -d build/symbols +``` + +| Option | Meaning | +| --- | --- | +| `-t` | The app token of the platform you built. | +| `-v` | Optional. The app version. Defaults to the `version:` of the `pubspec.yaml` in the folder you run it from. | +| `-d` | The folder you gave to `--split-debug-info`. | +| `-e` | Optional. Defaults to `https://api.bugsee.com/v2/`. | + +Use the short options. The script also accepts the long spellings, but it reads only the short ones, so `--token` and `--symdir` are silently ignored and nothing is uploaded. + +The script zips the `.symbols` files with a manifest and uploads the archive to Bugsee. Run it for each build you ship, and for each platform. + +## What is verified + +| Check | State | +| --- | --- | +| Android arm64 release build with the Dart snapshot layout before 3.14 (`--obfuscate`, emulator) | The report's stack decoded to the app's functions and lines with the build's own symbols file. | +| Android arm64 release build, Flutter 3.50 (Dart 3.14) | Decoded by the backend's decoder, **only when the stack's header is stripped first**. With the header, the decoder used by the backend and `flutter symbolize` of Flutter 3.50 both fail. See below. | +| Symbols of another build | Rejected by the offline check: the build ID is not in that file. | +| The symbols file reaching Bugsee through the production upload endpoint | **Not verified.** | +| iOS | **Not verified with a real stack.** A hand-written, header-less stack decoded correctly against the symbols file of a Flutter 3.50 iOS release build. A real iOS stack was not captured, so its header and address fields are unchecked. | +| Flutter 3.41 on a device | **Not verified.** | + +### Dart 3.14 + +Symbols files from Dart 3.14 (Flutter 3.50) hold `_kDartSnapshotText` and no `_kDartIsolateSnapshotInstructions`, the symbol that the header-based decoders of older Dart versions look for. A decoder that reads the header therefore fails on a Dart 3.14 stack, while the same stack decodes once everything above the first `#00` line is removed. + +That is what the backend's worker does today, as far as the plugin's tests could read. The decoding works because the header is stripped and the frames carry their virtual address, not because the decoder understands the new layout. If that processing changes, Dart 3.14 stacks can stop decoding. This is the state of the plugin's checks, not a guarantee about the server. + +## Related + +- [Dart errors](/sdk/flutter/dart-errors) and [Crash and error reporting](/sdk/flutter/manual/crash-error-reporting): how the errors are captured and what is in a report. +- [Symbolication overview](/sdk/flutter/symbolication/overview). diff --git a/docs/sdk/flutter/symbolication/ios.md b/docs/sdk/flutter/symbolication/ios.md new file mode 100644 index 00000000..ec5be4ec --- /dev/null +++ b/docs/sdk/flutter/symbolication/ios.md @@ -0,0 +1,51 @@ +--- +title: "Symbolication: iOS" +description: "Uploading dSYMs for a Flutter 10.x iOS app with a bugsee-cli Run Script build phase, what to set on the target, and which exit codes fail the build." +sidebar_position: 20 +slug: "/sdk/flutter/symbolication/ios" +--- + +:::warning[Beta] +This page documents Bugsee Flutter SDK **10.x**, which is in beta, is not published on pub.dev yet and can change between betas. The stable release is **9.x**: see the [9.x documentation](/sdk/flutter/v9/installation). Upgrading? See [Migrating from 9.x to 10.x](/sdk/flutter/migration). +::: + +Native iOS frames (your app, `Flutter.framework`, other plugins) show as addresses until Bugsee has the dSYMs of the build that produced them. In a Flutter app nothing uploads them for you: the Flutter build does not call the Bugsee uploader, and the plugin has no hook into Xcode. + +:::note[Not measured with a Flutter build] +This page follows the [Bugsee CLI documentation](/cli/xcode). The phase below was not run with a Flutter iOS build here, and a symbolicated native iOS crash from a Flutter app was not verified. Check the first release build you ship: see [Check that the upload happened](#check-that-the-upload-happened). +::: + +For the Dart frames of the same app see [Symbolication: Dart](/sdk/flutter/symbolication/dart). The native iOS side is covered in [iOS symbolication](/sdk/ios/symbolication). + +## Upload from a Run Script phase + +In Xcode, open the Runner target, **Build Phases**, add a **Run Script** phase after **Embed Frameworks** and call the CLI. `bugsee-cli` has to be installed where the build can reach it, see [CLI installation](/cli/installation). + +```sh title="Run Script phase" +"$SRCROOT/path/to/bugsee-cli" xcode upload-dsyms --app-token "$BUGSEE_APP_TOKEN" +``` + +The command scans `DWARF_DSYM_FOLDER_PATH`, which Xcode sets for every Run Script phase, and falls back to `/dSYMs`. It uploads dSYMs only: it does not register a build and is safe on every build. + +Two settings make it work: + +| Setting | Why | +| --- | --- | +| `ENABLE_USER_SCRIPT_SANDBOXING = NO` on the target | From Xcode 15 it defaults to `YES`, which stops a build phase from reading the dSYM folder. Alternatively declare the folder in the phase's input file lists. | +| `BUGSEE_APP_TOKEN` in the script's environment | A user-defined build setting of the target named `BUGSEE_APP_TOKEN` provides it. Use your **iOS** app token. | + +The CLI fails the build, exit code `20`, when the token is missing or empty. A failed upload fails the build on purpose: otherwise symbolication stops silently and the first sign is an unreadable report. The exit codes are in the [CLI documentation](/cli/xcode#xcode-upload-dsyms). + +## Upload from CI + +If you archive on a CI machine, upload the dSYMs of the archive instead of using a build phase: + +```sh +bugsee-cli debug-files upload /dSYMs --type dsym --version --build +``` + +See [Debug files](/cli/debug-files) for the options. + +## Check that the upload happened + +After the first release archive you ship, open a native crash from it in the dashboard and confirm that the frames show function names and lines. A crash on an iOS simulator is not a test: the SDK's simulator slice has no crash reporter, so use a physical iPhone. diff --git a/docs/sdk/flutter/symbolication/overview.md b/docs/sdk/flutter/symbolication/overview.md new file mode 100644 index 00000000..3215cbad --- /dev/null +++ b/docs/sdk/flutter/symbolication/overview.md @@ -0,0 +1,46 @@ +--- +title: "Symbolication overview" +description: "What Bugsee needs to turn Flutter 10.x release crash and error frames back into source, which build step uploads each piece, and which uploads are automatic or manual." +sidebar_position: 18 +slug: "/sdk/flutter/symbolication/overview" +--- + +:::warning[Beta] +This page documents Bugsee Flutter SDK **10.x**, which is in beta, is not published on pub.dev yet and can change between betas. The stable release is **9.x**: see the [9.x documentation](/sdk/flutter/v9/installation). Upgrading? See [Migrating from 9.x to 10.x](/sdk/flutter/migration). +::: + +A release build ships Dart code compiled ahead of time, Java and Kotlin code renamed by R8, and stripped native libraries. A crash or error from that build carries addresses and renamed symbols. To show your own file names, functions and lines, Bugsee needs the debug files of that exact build, uploaded when you build it. Without them the report is stored but its frames stay unreadable. + +A Flutter app has up to four kinds of frames in one report, and each has its own debug file and its own upload. + +## What gets symbolicated + +| Frames | Debug file | How it reaches Bugsee | +| --- | --- | --- | +| Android Java and Kotlin | R8 mapping (`mapping.txt`) | Automatic. The Bugsee Gradle plugin uploads it on every minified build (`uploadMapping`). | +| Android native (`libflutter.so`, your own `.so` files) | Unstripped native libraries | Automatic once you turn it on: `bugsee { ndk { enabled.set(true) } }`. It covers non-debuggable builds only. | +| Dart frames of a release build made with `--split-debug-info` (and `--obfuscate`) | `build/symbols/*.symbols` | **Manual.** Nothing in a Flutter build calls the Bugsee uploader, and `bugsee-cli` has no Flutter type yet. | +| iOS native (the app, `Flutter.framework`) | The build's dSYMs | **Manual in a Flutter app.** A Run Script build phase that runs `bugsee-cli xcode upload-dsyms`, or an upload from CI. | + +The Android Java and Kotlin mapping needs no setting at all once the Gradle plugin is applied, which the SDK requires anyway (see [Installation](/sdk/flutter/installation)). + +:::warning[Keep the symbols of every build you ship] +The backend finds the symbols by the build, not by the app version. Keep the `build/symbols` folder, the dSYMs and the R8 mapping of every build that reaches users, and upload them before the first crash can arrive. +::: + +## What is verified + +| Piece | State | +| --- | --- | +| Android Java and Kotlin, R8 mapping | Verified on emulators: exceptions from a release build with R8 and `--obfuscate`. | +| Dart frames, Android arm64, Flutter 3.50 | Decoded by the backend's symbolizer when given the stack as the backend feeds it, see [Symbolication: Dart](/sdk/flutter/symbolication/dart#what-is-verified). The upload of the symbols file through the production endpoint was not verified. | +| Dart frames, iOS | Not verified with a real device stack. A hand-written, header-less stack decoded against the symbols file of a release build. | +| iOS dSYMs | The setup comes from the Bugsee CLI documentation. It has not been measured with a Flutter build. | +| Native frames on Android | The build step is documented. Native crash symbolication needs a non-debuggable build with its libraries uploaded. | + +## Pages + +- [Symbolication: Android](/sdk/flutter/symbolication/android): the Gradle plugin, the R8 mapping and the native symbols. +- [Symbolication: iOS](/sdk/flutter/symbolication/ios): the dSYM upload phase. +- [Symbolication: Dart](/sdk/flutter/symbolication/dart): `--split-debug-info`, `--obfuscate` and the symbols upload. +- [Crash and error reporting](/sdk/flutter/manual/crash-error-reporting): how Dart errors reach Bugsee. diff --git a/docs/sdk/flutter/user-session-data.md b/docs/sdk/flutter/user-session-data.md new file mode 100644 index 00000000..8d71d217 --- /dev/null +++ b/docs/sdk/flutter/user-session-data.md @@ -0,0 +1,109 @@ +--- +title: "User & session data" +description: "Attach a user identifier and custom attributes to every report with Bugsee Flutter SDK 10.x: accepted values, platform size limits, reading them back, and the errors." +sidebar_position: 11 +slug: "/sdk/flutter/user-session-data" +--- + +:::warning[Beta] +This page documents Bugsee Flutter SDK **10.x**, which is in beta, is not published on pub.dev yet and can change between betas. The stable release is **9.x**: see the [9.x documentation](/sdk/flutter/v9/installation). Upgrading? See [Migrating from 9.x to 10.x](/sdk/flutter/migration). +::: + +Annotate every report with facts about the current user and session: a **user identifier**, which says who the user is, and custom key/value **attributes**, for anything else (plan, region, feature flags). Both go with every report the SDK sends. + +The snippets assume `import 'package:bugsee_flutter/bugsee_flutter.dart';`. + +## User identity + +The user identifier is one string, such as your backend user ID, that ties a user's reports together in the Bugsee dashboard. If it is an email address, the server may link reports to that user's account. The SDKs have this one field: there is no separate name or email (9.x had a separate email call; see [Migrating from 9.x to 10.x](/sdk/flutter/migration)). + +```dart +// Once the user has signed in +await Bugsee.setUserIdentifier('user-8f3a2c'); + +// Read it back: null when none is set +final id = await Bugsee.getUserIdentifier(); + +// On sign-out: attributes persist across launches, so clear them too +await Bugsee.clearUserIdentifier(); +await Bugsee.clearAllAttributes(); +``` + +| Method | Returns | Notes | +| --- | --- | --- | +| `setUserIdentifier(identifier)` | `Future` | An empty string clears the identifier, on both platforms. | +| `getUserIdentifier()` | `Future` | `null` when none is set. | +| `clearUserIdentifier()` | `Future` | Reports are no longer associated with a user. | + +The identifier is attached to every report from now on and persists across launches. It works before `launch` on both platforms. + +## Attributes + +Attributes are key/value pairs attached to every report. They **persist across launches** until you clear them, so set them when the fact changes (at sign-in, when the plan changes) rather than at every launch. + +```dart +await Bugsee.setAttribute('plan', 'pro'); +await Bugsee.setAttribute('beta-tester', true); +await Bugsee.setAttribute('seats', 12); +await Bugsee.setAttribute('discount', 0.15); + +final plan = await Bugsee.getAttribute('plan'); // 'pro', or null when not set +final all = await Bugsee.getAllAttributes(); // Map, empty when none +await Bugsee.clearAttribute('discount'); +await Bugsee.clearAllAttributes(); +``` + +| Method | Returns | Notes | +| --- | --- | --- | +| `setAttribute(name, value)` | `Future` | Sets or replaces the attribute. | +| `getAttribute(name)` | `Future` | `null` when not set. | +| `getAllAttributes()` | `Future>` | Empty when none. The map is not modifiable. | +| `clearAttribute(name)` | `Future` | Does nothing when it is not set. | +| `clearAllAttributes()` | `Future` | Removes every attribute. | + +Attributes work **before `launch`** on both platforms: the SDKs keep them outside the session, persisted across launches and stops. That makes `main()` before `Bugsee.launch` a fine place to restore them. + +### Accepted values + +| Part | Rule | +| --- | --- | +| `name` | Not empty. | +| `value` | A `String` (at most 1024 UTF-16 units), a `bool`, an `int`, or a finite `double` smaller in magnitude than the largest 32-bit float. | + +A `List`, `Map`, `null` or `DateTime` is refused in Dart. Convert them to a string first. + +Android stores a non-integer as a 32-bit float, and both `getAttribute` and `getAllAttributes` answer with that float's shortest decimal: `3.141592653589793` reads back as `3.1415927`. iOS keeps the double. If you need exact precision, store the number as a string. + +### Size limits and the read-back + +The SDKs **drop an over-limit value without saying so**: Android's call returns nothing, and iOS answers success even when it ignored the value. The wrapper therefore reads the value back after setting it. A value the SDK did not keep throws `BugseeAttributeException` with reason `AttributeFailure.rejected`, and the previous value stays. + +The limits differ per platform (measured by the maintainers): Android keeps a 1024-character string and about 42 values of 600 characters in all; iOS refuses a 1024-character string (its limit is the 1124-byte archive) and takes about 40 values of 600 characters. Keep attributes short and few, and do not put large blobs in them. + +### Errors + +Attribute calls throw `BugseeAttributeException` through the `Future`. It is a `BugseeException` but deliberately **not** a `BugseeArgumentException`, so `on BugseeArgumentException` keeps meaning "refused before the SDK". + +| `reason` | When | +| --- | --- | +| `AttributeFailure.invalidName` | The name is empty. Nothing reached the SDK. | +| `AttributeFailure.invalidValue` | The value is another type, a string over 1024 units, or not finite. Nothing reached the SDK. | +| `AttributeFailure.rejected` | The SDK did not keep the value (a size limit, or it could not store it). | + +`BugseeAttributeException.argument` names the parameter at fault (`name` or `value`). The message never contains the attribute value. + +```dart +try { + await Bugsee.setAttribute('notes', veryLongString); +} on BugseeAttributeException catch (e) { + debugPrint('attribute not stored: ${e.reason.name}'); +} +``` + +### Attributes on one report + +To set an attribute on a single report rather than on every report, use a [report handler](/sdk/flutter/report-handler) (`ReportProxy.setAttribute`) or a [created report](/sdk/flutter/manual/bug-reporting#build-a-report-yourself). + +## Privacy + +Attributes and the user identifier are exactly what you pass; Bugsee does not filter them. Do not store secrets or personal data you would not want in a report. See [Privacy](/sdk/flutter/privacy/overview). diff --git a/docs/sdk/flutter/appearance.md b/docs/sdk/flutter/v9/appearance.md similarity index 91% rename from docs/sdk/flutter/appearance.md rename to docs/sdk/flutter/v9/appearance.md index 392fa100..b9195108 100644 --- a/docs/sdk/flutter/appearance.md +++ b/docs/sdk/flutter/v9/appearance.md @@ -2,10 +2,14 @@ title: "Appearance" description: "Reference for all color customization options available for the Report and Feedback UI in the Bugsee Flutter SDK on iOS and Android." sidebar_position: 7 -slug: "/sdk/flutter/appearance" +slug: "/sdk/flutter/v9/appearance" --- -You can always change colors of the [Report](/sdk/flutter/manual/) and [Feedback](/sdk/flutter/feedback/) UI. +:::caution[Previous version] +This page documents Bugsee Flutter SDK **9.x** (`bugsee_flutter` 9.x), the current stable release. The new **10.x** SDK is a rewrite for the Bugsee 7.x native SDKs and is in beta, not yet published to pub.dev: see [Migrating from 9.x to 10.x](/sdk/flutter/migration/) to evaluate it, or the [10.x overview](/sdk/flutter/overview/). +::: + +You can always change colors of the [Report](/sdk/flutter/v9/manual/) and [Feedback](/sdk/flutter/v9/feedback/) UI. ```dart // For example diff --git a/docs/sdk/flutter/configuration.md b/docs/sdk/flutter/v9/configuration.md similarity index 90% rename from docs/sdk/flutter/configuration.md rename to docs/sdk/flutter/v9/configuration.md index b1dee1c1..2a74c9b3 100644 --- a/docs/sdk/flutter/configuration.md +++ b/docs/sdk/flutter/v9/configuration.md @@ -2,9 +2,13 @@ title: "Configuration" description: "All launch options and configuration parameters available for the Bugsee Flutter SDK on iOS and Android, with platform-specific option tables." sidebar_position: 1 -slug: "/sdk/flutter/configuration" +slug: "/sdk/flutter/v9/configuration" --- +:::caution[Previous version] +This page documents Bugsee Flutter SDK **9.x** (`bugsee_flutter` 9.x), the current stable release. The new **10.x** SDK is a rewrite for the Bugsee 7.x native SDKs and is in beta, not yet published to pub.dev: see [Migrating from 9.x to 10.x](/sdk/flutter/migration/) to evaluate it, or the [10.x overview](/sdk/flutter/overview/). +::: + ## Launching with options :::warning @@ -74,7 +78,7 @@ Future main() async { |killDetection|false|Detect abnormal termination (experimental, [read more](/sdk/ios/v6/app-kills/))| |maxRecordingTime|60|Maximum recording duration| |monitorDiskSpace|false|Enable monitoring of disk space. Disabled by default due to privacy limitations| -|monitorNetwork|true|Capture network traffic. Dart traffic additionally requires installing the HTTP overrides handler — see [Network capture](/sdk/flutter/network/)| +|monitorNetwork|true|Capture network traffic. Dart traffic additionally requires installing the HTTP overrides handler — see [Network capture](/sdk/flutter/v9/network/)| |reportPrioritySelector|false|Allow user to modify priority when reporting manually| |screenshotToReport|true|Screenshot key to trigger report| |shakeToReport|true|Shake gesture to trigger report| @@ -101,7 +105,7 @@ Future main() async { |frameRate|BugseeFrameRate.high|Specifies how often frames are captured| |maxDataSize|50|Maximum disk space consumed by Bugsee| |maxRecordingTime|60|Maximum recording duration| -|monitorNetwork|true|Capture network traffic. Dart traffic additionally requires installing the HTTP overrides handler — see [Network capture](/sdk/flutter/network/)| +|monitorNetwork|true|Capture network traffic. Dart traffic additionally requires installing the HTTP overrides handler — see [Network capture](/sdk/flutter/v9/network/)| |reportPrioritySelector|false|Allow user to modify priority when reporting manually| |screenshotEnabled|true|Attach screenshot to a report| |serviceMode|false|Used, when Bugsee is launched from service. No video and no visual controls available. Recording continues even in background.| diff --git a/docs/sdk/flutter/custom.md b/docs/sdk/flutter/v9/custom.md similarity index 88% rename from docs/sdk/flutter/custom.md rename to docs/sdk/flutter/v9/custom.md index cc850591..115170ce 100644 --- a/docs/sdk/flutter/custom.md +++ b/docs/sdk/flutter/v9/custom.md @@ -2,9 +2,13 @@ title: "Adding custom data" description: "How to attach user email, session attributes, custom traces, events, and file attachments to Bugsee reports in the Flutter SDK." sidebar_position: 3 -slug: "/sdk/flutter/custom" +slug: "/sdk/flutter/v9/custom" --- +:::caution[Previous version] +This page documents Bugsee Flutter SDK **9.x** (`bugsee_flutter` 9.x), the current stable release. The new **10.x** SDK is a rewrite for the Bugsee 7.x native SDKs and is in beta, not yet published to pub.dev: see [Migrating from 9.x to 10.x](/sdk/flutter/migration/) to evaluate it, or the [10.x overview](/sdk/flutter/overview/). +::: + ## User email When you already have your users identified within your app, you might want to automatically attach their email to the bug report. Bugsee provides APIs for setting, getting, and clearing the email. diff --git a/docs/sdk/flutter/v9/feedback.md b/docs/sdk/flutter/v9/feedback.md new file mode 100644 index 00000000..5acc3297 --- /dev/null +++ b/docs/sdk/flutter/v9/feedback.md @@ -0,0 +1,39 @@ +--- +title: "Feedback" +description: "How to show the in-app feedback messenger, receive new message notifications, and set a default greeting in the Bugsee Flutter SDK." +sidebar_position: 6 +slug: "/sdk/flutter/v9/feedback" +--- + +:::caution[Previous version] +This page documents Bugsee Flutter SDK **9.x** (`bugsee_flutter` 9.x), the current stable release. The new **10.x** SDK is a rewrite for the Bugsee 7.x native SDKs and is in beta, not yet published to pub.dev: see [Migrating from 9.x to 10.x](/sdk/flutter/migration/) to evaluate it, or the [10.x overview](/sdk/flutter/overview/). +::: + +Bugsee implements a built-in single-threaded messenger to allow your users to communicate with your support and developers. + +## Feedback controller + +To start the feedback controller from within your application + +```dart +Bugsee.showFeedbackUI(); +``` + +## Notifications + +To receive notifications about new messages arriving from the server, you should provide ```BugseeNewFeedbackMessagesHandler``` delegate callback: + +```dart +Bugsee.setNewFeedbackMessagesCallback((List messages) { + ... +}); +``` + +## Default greeting + +Default greeting can be set on the server in your application settings. However, for the cases when network is not available, you can +set default greeting on the client as well: + +```dart +Bugsee.setDefaultFeedbackGreeting("Hi! How can we help?"); +``` \ No newline at end of file diff --git a/docs/sdk/flutter/installation.md b/docs/sdk/flutter/v9/installation.md similarity index 83% rename from docs/sdk/flutter/installation.md rename to docs/sdk/flutter/v9/installation.md index b9e6f9ac..b8919c83 100644 --- a/docs/sdk/flutter/installation.md +++ b/docs/sdk/flutter/v9/installation.md @@ -2,9 +2,13 @@ title: "Installation" description: "Step-by-step guide to installing the Bugsee Flutter SDK via pub.dev and initializing it with proper error and isolate capture setup." sidebar_position: 0 -slug: "/sdk/flutter/installation" +slug: "/sdk/flutter/v9/installation" --- +:::caution[Previous version] +This page documents Bugsee Flutter SDK **9.x** (`bugsee_flutter` 9.x), the current stable release. The new **10.x** SDK is a rewrite for the Bugsee 7.x native SDKs and is in beta, not yet published to pub.dev: see [Migrating from 9.x to 10.x](/sdk/flutter/migration/) to evaluate it, or the [10.x overview](/sdk/flutter/overview/). +::: + :::info[Agent-Assisted Setup] Ask your AI coding assistant: @@ -24,7 +28,7 @@ dependencies: bugsee_flutter: ^9.0.0 ``` -See the [9.0.0 release notes](/sdk/flutter/release-notes/#900-march-6-2026) for 9.x breaking changes before upgrading from 8.x. +See the [9.0.0 release notes](/sdk/flutter/v9/release-notes/#900-march-6-2026) for 9.x breaking changes before upgrading from 8.x. ## Initialization @@ -61,7 +65,7 @@ class MyApp extends StatelessWidget { } ``` -See [configuration](/sdk/flutter/configuration/) to learn more on Bugsee launch options and customizations. +See [configuration](/sdk/flutter/v9/configuration/) to learn more on Bugsee launch options and customizations. ## Important tips to ensure all errors are captured diff --git a/docs/sdk/flutter/v9/lifecycle.md b/docs/sdk/flutter/v9/lifecycle.md new file mode 100644 index 00000000..39caaef4 --- /dev/null +++ b/docs/sdk/flutter/v9/lifecycle.md @@ -0,0 +1,43 @@ +--- +title: "Lifecycle events" +description: "How to subscribe to Bugsee SDK lifecycle events in Flutter, with a reference table of all available event types and their descriptions." +sidebar_position: 9 +slug: "/sdk/flutter/v9/lifecycle" +--- + +:::caution[Previous version] +This page documents Bugsee Flutter SDK **9.x** (`bugsee_flutter` 9.x), the current stable release. The new **10.x** SDK is a rewrite for the Bugsee 7.x native SDKs and is in beta, not yet published to pub.dev: see [Migrating from 9.x to 10.x](/sdk/flutter/migration/) to evaluate it, or the [10.x overview](/sdk/flutter/overview/). +::: + +Bugsee SDK silently works within your app, recording everything to assist you in debugging when something unexpected happens. Our SDK is designed as a black box, but there may be cases when you want to be notified about changes/events within Bugsee itself. Lifecycle events are designed exactly for that. Whenever internal state changes or some important event is raised, a lifecycle event is dispatched to the user code. + +## Implementing callback + +You should call **Bugsee.setLifecycleCallback** and provide the callback: + +```dart +void onBugseeLifecycleEvent(BugseeLifecycleEventType e) { + print(e); +} + +Bugsee.setLifecycleCallback(onBugseeLifecycleEvent); +``` + +## Available lifecycle events + +|Name|Description| +|-|-| +|launched|Event is dispatched when Bugsee was successfully launched| +|started|Event is dispatched when Bugsee is started after being stopped| +|stopped|Event is dispatched when Bugsee is stopped| +|resumed|Event is dispatched when video recording is resumed, i.e. when a [blackout](/sdk/flutter/v9/privacy/video/#blackout) is ended| +|paused|Event is dispatched when video recording is paused, i.e. when a [blackout](/sdk/flutter/v9/privacy/video/#blackout) is started| +|relaunchedAfterCrash|Event is dispatched when Bugsee is launched and pending crash report is discovered. That usually means that app was relaunched after crash.| +|beforeReportShown|Event is dispatched before the reporting UI is shown| +|afterReportShown|Event is dispatched when reporting UI is shown| +|beforeReportUploaded|Event is dispatched when report is about to be uploaded to the server| +|afterReportUploaded|Event is dispatched when report was successfully uploaded to the server| +|beforeFeedbackShown|Event is dispatched before the Feedback controller is shown| +|afterFeedbackShown|Event is dispatched after the Feedback controller is shown| +|beforeReportAssembled|Event is dispatched right before bug/error/crash report is about to be assembled| +|afterReportAssembled|Event is dispatched right after bug/error/crash report is assembled| \ No newline at end of file diff --git a/docs/sdk/flutter/logs.md b/docs/sdk/flutter/v9/logs.md similarity index 67% rename from docs/sdk/flutter/logs.md rename to docs/sdk/flutter/v9/logs.md index 44717a21..a08960ce 100644 --- a/docs/sdk/flutter/logs.md +++ b/docs/sdk/flutter/v9/logs.md @@ -2,9 +2,13 @@ title: "Logging" description: "How to send custom log messages with severity levels directly into Bugsee reports using the Flutter SDK logging API." sidebar_position: 4 -slug: "/sdk/flutter/logs" +slug: "/sdk/flutter/v9/logs" --- +:::caution[Previous version] +This page documents Bugsee Flutter SDK **9.x** (`bugsee_flutter` 9.x), the current stable release. The new **10.x** SDK is a rewrite for the Bugsee 7.x native SDKs and is in beta, not yet published to pub.dev: see [Migrating from 9.x to 10.x](/sdk/flutter/migration/) to evaluate it, or the [10.x overview](/sdk/flutter/overview/). +::: + Out of the box Bugsee automatically captures all standard application console logs both on Android and iOS. Alternatively, we provide other methods to log messages directly into Bugsee reports. These methods maintain log levels for each message and later allow filtering diff --git a/docs/sdk/flutter/manual.md b/docs/sdk/flutter/v9/manual.md similarity index 75% rename from docs/sdk/flutter/manual.md rename to docs/sdk/flutter/v9/manual.md index efa2c46c..5503ba46 100644 --- a/docs/sdk/flutter/manual.md +++ b/docs/sdk/flutter/v9/manual.md @@ -2,9 +2,13 @@ title: "Manual invocation" description: "How to programmatically show the report dialog, upload issues from custom UI, and log handled exceptions using the Bugsee Flutter SDK." sidebar_position: 2 -slug: "/sdk/flutter/manual" +slug: "/sdk/flutter/v9/manual" --- +:::caution[Previous version] +This page documents Bugsee Flutter SDK **9.x** (`bugsee_flutter` 9.x), the current stable release. The new **10.x** SDK is a rewrite for the Bugsee 7.x native SDKs and is in beta, not yet published to pub.dev: see [Migrating from 9.x to 10.x](/sdk/flutter/migration/) to evaluate it, or the [10.x overview](/sdk/flutter/overview/). +::: + ## Report view In addition to detection of a shake gesture or screenshot issue report view can be triggered programmatically: diff --git a/docs/sdk/flutter/network.md b/docs/sdk/flutter/v9/network.md similarity index 72% rename from docs/sdk/flutter/network.md rename to docs/sdk/flutter/v9/network.md index 0bd1b2af..26d312f4 100644 --- a/docs/sdk/flutter/network.md +++ b/docs/sdk/flutter/v9/network.md @@ -2,12 +2,16 @@ title: "Network capture" description: "How to enable Bugsee network traffic interception in Flutter by installing the custom HTTP overrides handler." sidebar_position: 8 -slug: "/sdk/flutter/network" +slug: "/sdk/flutter/v9/network" --- +:::caution[Previous version] +This page documents Bugsee Flutter SDK **9.x** (`bugsee_flutter` 9.x), the current stable release. The new **10.x** SDK is a rewrite for the Bugsee 7.x native SDKs and is in beta, not yet published to pub.dev: see [Migrating from 9.x to 10.x](/sdk/flutter/migration/) to evaluate it, or the [10.x overview](/sdk/flutter/overview/). +::: + Flutter implements its own network stack and does not use the underlying iOS or Android ones. Capturing Dart traffic therefore takes **two** things, and both are required: -1. The **`monitorNetwork`** launch option must be enabled. It is `true` by default — see [configuration](/sdk/flutter/configuration/). +1. The **`monitorNetwork`** launch option must be enabled. It is `true` by default — see [configuration](/sdk/flutter/v9/configuration/). 2. The Bugsee HTTP overrides handler must be **installed explicitly**. There is no default for this one: ```dart diff --git a/docs/sdk/flutter/v9/privacy/logs.md b/docs/sdk/flutter/v9/privacy/logs.md new file mode 100644 index 00000000..048fcff9 --- /dev/null +++ b/docs/sdk/flutter/v9/privacy/logs.md @@ -0,0 +1,34 @@ +--- +title: "Privacy and console logs" +description: "How to disable console log collection or sanitize log content in Flutter to remove personally identifiable information before it is recorded." +sidebar_position: 2 +slug: "/sdk/flutter/v9/privacy/logs" +--- + +:::caution[Previous version] +This page documents Bugsee Flutter SDK **9.x** (`bugsee_flutter` 9.x), the current stable release. The new **10.x** SDK is a rewrite for the Bugsee 7.x native SDKs and is in beta, not yet published to pub.dev: see [Migrating from 9.x to 10.x](/sdk/flutter/migration/) to evaluate it, or the [10.x overview](/sdk/flutter/overview/). +::: + +## Disabling log collection + +Console log collection can be disabled completely using **captureLogs** launch option. See [configuration](/sdk/flutter/v9/configuration/) for more info. + +## Sanitizing console logs + +Bugsee automatically captures all standard application console logs, but they can be protected as well. + +For every event to be recorded, Bugsee will call your method and provide you with a **BugseeLogEvent** object. It is your +method's responsibility to clean up all user identifiable data from that structure and return a sanitized event back + +### Providing handler + +You should pass a callback method to Bugsee.setLogFilter(). + +```dart +Future onBugseeLogEvent(BugseeLogEvent logEvent) { + logEvent.text = "Filtered: " + logEvent.text; + return Future.value(logEvent); +} + +Bugsee.setLogFilter(onBugseeLogEvent); +``` diff --git a/docs/sdk/flutter/v9/privacy/network.md b/docs/sdk/flutter/v9/privacy/network.md new file mode 100644 index 00000000..6a112e1f --- /dev/null +++ b/docs/sdk/flutter/v9/privacy/network.md @@ -0,0 +1,60 @@ +--- +title: "Privacy and Network traffic" +description: "How to disable network monitoring or filter sensitive data from captured network requests and responses in Flutter using a callback handler." +sidebar_position: 3 +slug: "/sdk/flutter/v9/privacy/network" +--- + +:::caution[Previous version] +This page documents Bugsee Flutter SDK **9.x** (`bugsee_flutter` 9.x), the current stable release. The new **10.x** SDK is a rewrite for the Bugsee 7.x native SDKs and is in beta, not yet published to pub.dev: see [Migrating from 9.x to 10.x](/sdk/flutter/migration/) to evaluate it, or the [10.x overview](/sdk/flutter/overview/). +::: + +## Disabling network traffic collection + +Network traffic collection can be disabled completely using the **monitorNetwork** launch option. This covers both Dart and native platform traffic — with `monitorNetwork` set to `false`, nothing is captured even if the HTTP overrides handler below is installed. See [configuration](/sdk/flutter/v9/configuration/) for more info. + +## Initializing +In order to let Bugsee intercept network traffic, the following needs to be added to the launch code of your app. + +```dart +HttpOverrides.global = Bugsee.defaultHttpOverrides; +``` + +## Sanitizing data + +Bugsee captures network activity from the application and stores headers and in some cases body of the request and response. +In order to allow you to hide user identifiable and other sensitive data from these network logs, we provide you with the +ability to set your own filter via a callback we will call for every event about to be recorded. + +For every event to be recorded, Bugsee will call your method and provide you with an **BugseeNetworkEvent** object. It is your +method's responsibility to clean up all user identifiable data from that structure and return a sanitized event back. + + +### Providing handler + +You should pass a callback method: + +```dart +Future onBugseeNetworkEvent(BugseeNetworkEvent e) { + e.url = ""; + return Future.value(e); +} + +Bugsee.setNetworkFilter(onBugseeNetworkEvent); +``` + +### Network Events + +The callback is going to be called several times for each network request, depending on its life cycle. Usually for +successful requests it's going to be called twice, once with the request event (request headers and body) and one more time after +completion and will contain headers and body of the response. Note that callback can be called more times, initially without body and then with it for both request and response. + + +|Property|Description|Type|Read only|Notes +|---|---|---|---|---| +|body|Body|String|No|Raw body of the request or response where available. +|type|Type of network event|String|No|Can be one of 'before', 'complete', 'error', 'cancel' +|headers|HTTP Headers|Map|No| +|method|HTTP Request Method|String|No|'GET', 'POST', etc... +|redirectUrl|URL of Network event that we were redirected from|String|No| +|Url|Network event URL|String|No| \ No newline at end of file diff --git a/docs/sdk/flutter/v9/privacy/overview.md b/docs/sdk/flutter/v9/privacy/overview.md new file mode 100644 index 00000000..ada9f98a --- /dev/null +++ b/docs/sdk/flutter/v9/privacy/overview.md @@ -0,0 +1,21 @@ +--- +title: "Privacy overview" +description: "Overview of privacy considerations and available tools to prevent or sanitize personally identifiable data in Bugsee Flutter SDK reports." +sidebar_position: 0 +slug: "/sdk/flutter/v9/privacy/overview" +--- + +:::caution[Previous version] +This page documents Bugsee Flutter SDK **9.x** (`bugsee_flutter` 9.x), the current stable release. The new **10.x** SDK is a rewrite for the Bugsee 7.x native SDKs and is in beta, not yet published to pub.dev: see [Migrating from 9.x to 10.x](/sdk/flutter/migration/) to evaluate it, or the [10.x overview](/sdk/flutter/overview/). +::: + +Bugsee SDK does not continuously stream any personal data. The reports are stored locally on the phone in a cyclical buffer. Reports are being sent only when triggered by a crash, through a bug reporting UI or from an application's code. +Data sent along with the reports may include video recording of screen, network and console logs. These may potentially contain personal data (usernames, passwords, emails, etc). + +It is the sole responsibility of the application developers to remove any such data from the reports before it leaves the users’ device. + +Bugsee provides the tools and means to either prevent some data from being collected or clean the data during the collection process: + +* [Video and Touch](/sdk/flutter/v9/privacy/video/) +* [Console logs](/sdk/flutter/v9/privacy/logs/) +* [Network logs](/sdk/flutter/v9/privacy/network/) \ No newline at end of file diff --git a/docs/sdk/flutter/v9/privacy/video.md b/docs/sdk/flutter/v9/privacy/video.md new file mode 100644 index 00000000..15bfb380 --- /dev/null +++ b/docs/sdk/flutter/v9/privacy/video.md @@ -0,0 +1,55 @@ +--- +title: "Privacy and video" +description: "How to disable video recording or obscure sensitive Flutter views and screen regions to protect user privacy in recorded sessions." +sidebar_position: 1 +slug: "/sdk/flutter/v9/privacy/video" +--- + +:::caution[Previous version] +This page documents Bugsee Flutter SDK **9.x** (`bugsee_flutter` 9.x), the current stable release. The new **10.x** SDK is a rewrite for the Bugsee 7.x native SDKs and is in beta, not yet published to pub.dev: see [Migrating from 9.x to 10.x](/sdk/flutter/migration/) to evaluate it, or the [10.x overview](/sdk/flutter/overview/). +::: + +## Disabling video + +Video recording can be disabled completely using **videoEnabled** launch option. See [configuration](/sdk/flutter/v9/configuration/) for more info. + +## Blackout + +You can temporarily black out the whole video and stop recording touch events, without stopping the rest of the data capture (logs, network, events): + +```dart +// Black out the video +Bugsee.pause(); + +// Resume normal video recording +Bugsee.resume(); +``` + +## Protecting flutter views + +Bugsee automatically obscures ```TextField``` views with ```obscureText``` option set to true. Also, you can wrap any view sub-tree with ```BugseeSecureView``` to make it obscured on video. ```BugseeSecureView``` has ```enabled``` option for your convenience, thus you don't need to add/remove the element to toggle obscuring on/off. + +## Protecting by coordinates + +Bugsee allows hiding screen area by absolute coordinates as well: + +> **Note:** BugseeSecureRect coordinates are in pixels, with origin (0,0) being the top left corner. + +```dart +// Coordinates are: X, Y, Width, Height + +// Add secure rectangle +Bugsee.addSecureRect(new Rectangle(20, 20, 100, 100)); + +// Remove secure rectangle +Bugsee.removeSecureRect(new Rectangle(10, 10, 100, 100)); + +// Remove all rectangles +Bugsee.removeAllSecureRects(); + +// Get all rectangles as BugseeSecureRect[] +dynamic rectangles = await Bugsee.getAllSecureRects(); +``` + +You need to be aware of the orientation that can be changed while the app is running. +Recreate all rectangles after orientation change, if 'black box' on video does not cover all secure data that you need. \ No newline at end of file diff --git a/docs/sdk/flutter/v9/release-notes.md b/docs/sdk/flutter/v9/release-notes.md new file mode 100644 index 00000000..a872df79 --- /dev/null +++ b/docs/sdk/flutter/v9/release-notes.md @@ -0,0 +1,234 @@ +--- +title: "Release notes" +description: "Changelog for the Bugsee Flutter SDK listing new features, bug fixes, and breaking changes for each released version." +sidebar_position: 11 +slug: "/sdk/flutter/v9/release-notes" +--- + +:::caution[Previous version] +This page documents Bugsee Flutter SDK **9.x** (`bugsee_flutter` 9.x), the current stable release. The new **10.x** SDK is a rewrite for the Bugsee 7.x native SDKs and is in beta, not yet published to pub.dev: see [Migrating from 9.x to 10.x](/sdk/flutter/migration/) to evaluate it, or the [10.x overview](/sdk/flutter/overview/). +::: + +## 9.0.4 (August 18 2026) +- Feat: Updated native SDKs to their latest versions (Android: [6.0.4](/sdk/android/v6/release-notes/#604-june-22-2026), iOS: [6.3.1](/sdk/ios/v6/release-notes/#631-july-31-2026)) + +## 9.0.3 (March 26 2026) +- Fix: Improper artifacts placement for iOS + +## 9.0.2 (March 20 2026) +- Feat: Updated native SDKs to their latest versions (Android: [6.0.2](/sdk/android/v6/release-notes/#602-march-11-2026), iOS: [6.1.2](/sdk/ios/v6/release-notes/#612-march-4-2026)) + +## 9.0.0 (March 6 2026) +- Feat: Updated native SDKs to their latest versions (Android: [6.0.0](/sdk/android/v6/release-notes/#600-december-9-2025), iOS: [6.1.2](/sdk/ios/v6/release-notes/#612-march-4-2026)) +- Breaking: \[iOS\] Minimum deployment target is iOS 12.0 +- Breaking: \[Android\] Bugsee SDK is now built with Android SDK version 35, hence requires compileSDKVersion 35 +- Breaking: \[Android\] AGP 8.6.0 or newer is now required + +## 8.6.9 (November 18 2025) +- Feat: Updated native SDKs to their latest versions (Android: [5.9.1](/sdk/android/v6/release-notes/#591-september-29-2025), iOS: [5.5.9](/sdk/ios/v6/release-notes/#559-november-17-2025)) + +## 8.6.8 (October 15 2025) +- Feat: Updated native SDKs to their latest versions (Android: [5.9.1](/sdk/android/v6/release-notes/#591-september-29-2025), iOS: [5.5.8](/sdk/ios/v6/release-notes/#558-august-21-2025)) + +## 8.6.7 (September 23 2025) +- Feat: Updated native SDKs to their latest versions (Android: [5.8.7](/sdk/android/v6/release-notes/#587-september-9-2025), iOS: [5.5.8](/sdk/ios/v6/release-notes/#558-august-21-2025)) + +## 8.6.6 (August 21 2025) +- Feat: Updated native SDKs to their latest versions (Android: [5.8.4](/sdk/android/v6/release-notes/#584-august-21-2025), iOS: [5.5.8](/sdk/ios/v6/release-notes/#558-august-21-2025)) + +## 8.6.5 (June 12 2025) +- Feat: Updated native SDKs to their latest versions (Android: [5.7.5](/sdk/android/v6/release-notes/#575-june-8-2025), iOS: [5.5.6](/sdk/ios/v6/release-notes/#556-march-25-2025)) +- Fix: \[Android\] In some configurations, application may crash on device with 16KB memory pages + +## 8.6.4 (May 6 2025) +- Feat: Updated native SDKs to their latest versions (Android: [5.7.3](/sdk/android/v6/release-notes/#573-may-5-2025), iOS: [5.5.6](/sdk/ios/v6/release-notes/#556-march-25-2025)) + +## 8.6.3 (March 17 2025) +- Feat: Updated native SDKs to their latest versions (Android: [5.7.2](/sdk/android/v6/release-notes/#572-march-17-2025), iOS: [5.5.5](/sdk/ios/v6/release-notes/#555-february-13-2025)) + +## 8.6.0 - 8.6.2 (March 10 2025) +- Feat: Updated native SDKs to their latest versions (Android: [5.7.1](/sdk/android/v6/release-notes/#571-march-4-2025), iOS: [5.5.5](/sdk/ios/v6/release-notes/#555-february-13-2025)) +- Feat: Swift Package Manager support added + +## 8.5.0 (February 20 2025) +- Feat: Full Flutter 3.29 support +- Feat: Updated native SDKs to their latest versions (Android: [5.7.0](/sdk/android/v6/release-notes/#570-february-12-2025), iOS: [5.5.5](/sdk/ios/v6/release-notes/#555-february-13-2025)) + +## 8.4.3 (February 4 2025) +- Feat: Updated native SDKs to their latest versions (Android: [5.6.5](/sdk/android/v6/release-notes/#565-february-3-2025), iOS: [5.5.4](/sdk/ios/v6/release-notes/#554-january-27-2025)) +- Fix: \[Android\] Built-in UI shifts upwards in some scenarios on Android 15 (specifically, when hosting application itself is targeting Android 15, i.e. target SDK version is 35) + +## 8.4.2 (November 23 2024) +- Feat: Updated native SDKs to their latest versions (Android: 5.6.5, iOS: 5.5.4) + +## 8.4.1 (November 20 2024) +- Feat: Internal improvements + +## 8.4.0 (September 12 2024) +- Feat: Updated native SDKs to their latest versions (Android: 5.4.2, iOS: 5.3.2) +- Feat: \[Android\] Add support for 16KB memory pages +- Fix: \[Android\] Crash when bug is sent from built-in reporting UI after removing screenshot + +## 8.3.0 (August 5 2024) +- Feat: Improved Isolate errors handling and corresponding new APIs + +## 8.2.1 (April 24 2024) +- Fix: Use SDK version 34 for Android build + +## 8.2.0 (April 22 2024) +- Fix: More reliable stack trace capture +- Feat: MonitorDiskSpace launch option is added + +## 8.1.0 (April 19 2024) +- Fix: \[Android\] In some cases, video before FG->BG->FG transitions may be absent +- Note: \[Android\] compileSdkVersion 34 and up is now required + +## 8.0.2 (April 11 2024) +- Feat: Updated dependencies to their latest versions (Android: 4.2.4, iOS: 5.0.2) + +## 8.0.1 (April 11 2024) +- Feat: Updated dependencies to their latest versions (Android: 4.2.4, iOS: 5.0.0) + +## 8.0.0 (January 15 2024) +- Feat: Updated dependencies to their latest versions +- Breaking: Minimal supported Dart SDK version is now 3.0.0 + +## 7.0.0 (December 25 2023) +- Feat: Updated native SDKs to their latest versions (Android: 4.2.1, iOS: 5.0.0) +- Breaking: \[iOS\] Bitcode is not present in the resulting binaries any more + +## 6.1.0 (December 6 2023) +- Feat: Updated native SDKs to their latest versions (Android: 4.2.1, iOS: 4.1.0) + +## 6.0.1 (October 2 2023) +- Feat: Updated native SDKs to their latest versions (Android: [4.0.1](/sdk/android/v6/release-notes/#401-september-30-2023), iOS: [4.0.1](/sdk/ios/v6/release-notes/#401-september-30-2023)) + +## 6.0.0 (September 25 2023) +- Feat: Updated native SDKs to their latest versions (Android: 4.0.0, iOS: 4.0.0) +- Feat: Full compatibility with iOS 17.0 and Android 14 +- Breaking: \[iOS\] Minimum deployment target is iOS 11.0 (was 9.0) +- Breaking: \[iOS\] ARMv7 is not supported any more. +- Breaking: \[Android\] Bugsee SDK is build against Gradle 7.5, AGP 7.4.2 +- Breaking: \[Android\] Bugsee SDK is build with targetSdk and compileSdk of version 33 + +## 5.4.0 (August 31 2023) +- Feat: Updated native SDKs to their latest versions (Android: 3.10.0, iOS: 3.8.0) +- Feat: Add new API to manually trigger view hierarchy capturing. Multiple view hierarchies support. + +## 5.3.2 (August 17 2023) +- Fix: Build on iOS may fail due to invalid methods' signatures + +## 5.3.1 (July 12 2023) +- Feat: Updated native SDKs to their latest versions (Android: 3.8.2, iOS: 3.7.1) +- Fix: \[Android\] In some circumstances crashes may not be reported + +## 5.3.0 (June 6 2023) +- Feature: Update native SDKs to the latest versions (Android: 3.8.1, iOS: 3.6.0) +- Feature: Improved backward compatibility with upcoming versions of Flutter and Dart + +## 5.2.0 (April 24 2023) +- Feature: Update native Android SDK to the latest version 3.7.0 +- Feature: Improved interaction with the WebView. Now it's stable and captures more network requests. + +## 5.1.0 (April 6 2023) +- Feature: Update native SDKs to the latest versions (Android: 3.6.0, iOS: 3.5.0) +- Feature: Ability to change placeholders for the input fields in the built-in bug reporting UI + +## 5.0.5 (March 8 2023) +- Fix: Incorrect underlying Bugsee Android SDK was used. Now using (Android: 3.4.0, iOS: 3.3.3) + +## 5.0.4 (February 26 2023) +- Feature: Updated native SDKs to their latest versions + +## 5.0.3 (January 26 2023) +- Feature: Updated native SDKs to their latest versions + +## 5.0.2 (November 24 2022) +- Feature: Update native SDKs to the latest versions (Android: 3.0.2, iOS: 3.2.1) +- Fix: Properly specify fallback value for 'compileSdkVersion' + +## 5.0.1 (October 26 2022) +- Feature: Update native SDKs to the latest versions (Android: 3.0.0, iOS: 3.1.2) +- Fix: Secure rectangles serialization/deserialization issues + +## 5.0.0 (October 14 2022) +- Breaking: Support for Flutter 2.X and earlier is dropped. Only Flutter 3.0 and up is now supported +- Fix: Exception may be thrown when showReportDialog() and upload() is called with no data + +## 4.0.0 (September 6 2022) +- Fix: Properly intercept and filter network requests made from native code +- Feature: Update native SDKs to the latest versions (Android: 3.0.0, iOS: 3.0.0) +- Note: Please refer to the underlying SDKs release notes to get the detailed list of changes: [Android](/sdk/android/v6/release-notes/#300-august-19-2022) / [iOS](/sdk/ios/v6/release-notes/#300-september-1-2022) + +## 3.1.0 (July 8 2022) +- Feat: Update public method types and improve code style + +## 3.0.3 (May 30 2022) +- Feat: Update underlying SDKs to their latest versions (several race conditions were fixed) + +## 3.0.2 (May 23 2022) +- Feat: Add missing parts (example and pubspec fields) to pub.dev package + +## 3.0.1 (May 16 2022) +- Feat: Flutter 3 support + +## 2.1.2 (April 18 2022) +- Feat: Update underlying SDKs to their latest versions +- Feat: View hierarchy now captures more data for each node + +## 2.1.1 (April 8 2022) +- Fix: Add missing required components for view hierarchy capturing + +## 2.1.0 (April 7 2022) +- Feat: View hierarchy is now also captured for the Flutter widget tree + +## 2.0.0 (March 7 2022) +- Feat: Update underlying SDKs to their latest versions +- Fix: iOS SDK does not require cleanup script any more +- Feat: Secure views are now automatically obscured on video +- Breaking change: Underlying Bugsee Android SDK is now fully migrated to AndroidX + +## 1.3.1 (January 17 2022) +- Fix: Add missing NotificationBarTrigger launch option for Android +- Feat: Update dependencies to their latest versions + +## 1.3.0 (December 16 2021) +- Fix: In some rare cases not all crash reports may be sent to the server upon next relaunch \[iOS\] + +## 1.2.0 (November 14 2021) +- Feat: Make Bugsee Flutter SDK compatible with Flutter pre-2.5 + +## 1.1.1 (November 9 2021) +- Fix: Properly intercept all console logs +- Fix: Do not block/hang when Bugsee is launched from background app + +## 1.1.0 (October 4 2021) +- Feat: Update native SDKs to their latest versions +- Feat: Make SDK compatible and fully functional on iOS 15 and Android 12 + +## 1.0.8 (September 17 2021) +- Fix: Make code compatible with Flutter 2.5 + +## 1.0.7 (August 9 2021) +- Fix: Build failure with CocoaPods 1.10.2 + +## 1.0.6 (July 25 2021) +- Fix: Previous deployment ended up with inconsistent versions. This follow up release fixes it + +## 1.0.5 (July 25 2021) +- Fix: Properly populate versions for Bugsee Flutter wrapper and native Bugsee SDKs + +## 1.0.4 (July 18 2021) +- Fix: Properly handle exceptions with empty stack traces + +## 1.0.3 (July 10 2021) +- Fix: Add missing checks in the Android bridging module + +## 1.0.2 (July 6 2021) +- Fix: Fixing iOS build failure in some environments + +## 1.0.1 (June 28 2021) +- Fix: Network events interception and filtering + +## 1.0.0 (May 25 2021) +- Initial release diff --git a/docs/sdk/flutter/symbolication.md b/docs/sdk/flutter/v9/symbolication.md similarity index 84% rename from docs/sdk/flutter/symbolication.md rename to docs/sdk/flutter/v9/symbolication.md index deb0629a..0508c38a 100644 --- a/docs/sdk/flutter/symbolication.md +++ b/docs/sdk/flutter/v9/symbolication.md @@ -2,9 +2,13 @@ title: "Crash symbolication" description: "How to upload Flutter debug symbols to Bugsee so that obfuscated Dart stack traces are resolved into readable function names and line numbers." sidebar_position: 10 -slug: "/sdk/flutter/symbolication" +slug: "/sdk/flutter/v9/symbolication" --- +:::caution[Previous version] +This page documents Bugsee Flutter SDK **9.x** (`bugsee_flutter` 9.x), the current stable release. The new **10.x** SDK is a rewrite for the Bugsee 7.x native SDKs and is in beta, not yet published to pub.dev: see [Migrating from 9.x to 10.x](/sdk/flutter/migration/) to evaluate it, or the [10.x overview](/sdk/flutter/overview/). +::: + ## Debug Symbols Debug symbols provide information that Bugsee uses to decipher stack traces generated by an application. diff --git a/docs/sdk/flutter/view-hierarchy.md b/docs/sdk/flutter/view-hierarchy.md new file mode 100644 index 00000000..1fd28241 --- /dev/null +++ b/docs/sdk/flutter/view-hierarchy.md @@ -0,0 +1,117 @@ +--- +title: "View hierarchy" +description: "What the Flutter widget tree in a Bugsee Flutter SDK 10.x report contains (widget type names and boxes only), when it is built, how fresh it is, and how to turn it off." +sidebar_position: 12 +slug: "/sdk/flutter/view-hierarchy" +--- + +:::warning[Beta] +This page documents Bugsee Flutter SDK **10.x**, which is in beta, is not published on pub.dev yet and can change between betas. The stable release is **9.x**: see the [9.x documentation](/sdk/flutter/v9/installation). Upgrading? See [Migrating from 9.x to 10.x](/sdk/flutter/migration). +::: + +A report carries the view hierarchy: a tree of the elements on screen, with their positions and sizes, that the Bugsee viewer shows next to the video. + +A Flutter app is one native view, so the native SDKs' own capture sees a single `FlutterView` and nothing of the UI. The plugin therefore also builds the **Flutter widget tree** and gives it to the SDK, which stores it in the report beside the native tree. Nothing is needed to enable it: it is on by default, and it follows the SDK's own `captureViewHierarchy` option. + +## What the tree contains + +Each node of the Flutter tree describes one widget that is on stage and painted: + +| Field | Meaning | +| --- | --- | +| `class_name` | The widget's `runtimeType` without generic arguments (`Scaffold`, `Text`, `_LoginState`), at most 80 characters. The root is `FlutterView`; a secure view is `BugseeSecureView`. | +| `base_class_name` | For widgets that own a render object, the render object's type (`RenderPadding`). | +| `bounds` | The box on the screen, in the unit of the platform's native tree (physical pixels on Android, points on iOS), rounded outward. | +| `options` | Only what is set: `secure`, `clickable` (a tap or long-press callback exists), `alpha` (an `Opacity` value), `content_kind` (`image` or `surface`, which says that pixels exist and nothing about them). The root also carries `age_ms`, `device_pixel_ratio`, `obfuscated` and `truncated`. | +| `subitems` | The painted children, in paint order, back to front. | + +Only what is on stage and painted is listed. These are not in the tree: an `Offstage` subtree, a `Visibility(visible: false)`, a zero `Opacity`, the other children of an `IndexedStack`, a route an opaque route covers, a widget wholly outside the screen or outside a clip of an ancestor (a list item scrolled out of its viewport), and a widget that was never laid out. Inherited widgets such as `Theme` and `MediaQuery` have no box and are not nodes. + +The soft keyboard and native windows are not Flutter's, so they come from the native tree. Only the app's main view (the implicit view) is described on mobile. + +Under `--obfuscate`, type names are minified, and the root says so (`options.obfuscated`). They are flagged, not decoded. + +## What it never contains + +The SDK stores the Flutter tree without reading it, so the plugin enforces what goes into it. The tree is built from **type names and structure only**. It never contains: + +- text of any kind: the content of `Text`, `RichText`, `SelectableText`, text fields, chips or list tiles; +- the value of a `TextEditingController` or anything the user typed; +- semantics labels, hints, values, identifiers or tooltips; +- a `Key` or `ValueKey`, a `Hero` tag, a route name or a restoration id; +- the result of `toString()` on a widget or element; +- image data. + +Every name in the tree is an identifier (`[A-Za-z_$][A-Za-z0-9_$]*`); anything else is replaced by `Widget` (or `RenderObject`). A widget's node `id` is its position in the snapshot, not derived from anything your app wrote. + +A class name is chosen by you as a developer and is not user data, but it is the one thing the tree says about your own code. Keep that in mind if a class name itself would be sensitive. + +If building the tree fails for any reason, nothing is sent, and the previous snapshot is taken back. Nothing is thrown into your app. + +### Secure views + +A [`BugseeSecureView`](/sdk/flutter/privacy/video#hiding-a-widget-bugseesecureview) subtree is **one node**: the node is named `BugseeSecureView`, carries `secure: true` and a box that covers the same area as the video mask, and has nothing below it, not even the type names of the children. + +Two cases are not covered, the same as for the video mask: + +- Pixels a widget draws outside its own subtree (an `Overlay` tooltip or magnifier) are not part of the secure node. They appear as ordinary nodes with their type and box, never text. +- A secure region that has just appeared is described as an ordinary subtree (type names and boxes) until the next snapshot, at most the throttle plus the frame it appeared in. + +### Blackout + +During a [blackout](/sdk/flutter/privacy/video#blackout) the view hierarchy is not captured. + +## When it is built + +The plugin keeps a copy of the tree up to date, and the SDK reads it when it makes a report. Dart builds the tree only when all three hold: + +1. The SDK is `launched`. +2. The `captureViewHierarchy` option is on (it is by default). +3. The app is in the foreground. + +Otherwise nothing is built, and the copy the SDK would read is cleared. A detached engine serves nothing, never a stale tree. + +While it is active, the plugin is built not to disturb your UI: + +- It builds only after a frame or from a timer, never inside a frame, and schedules no frame of its own. An idle app does no work. +- It builds after the app has been quiet for 100 ms, so a scroll, a fling or an animation is not delayed by it. A screen that never stops drawing (a spinner) gets one build every 3 seconds. +- It spaces builds at least 300 ms apart, more after an expensive build, and sends a snapshot only when it changed. + +## Calling it yourself + +```dart +await Bugsee.captureViewHierarchy(); +``` + +`Bugsee.captureViewHierarchy()` brings the plugin's copy up to date and asks the SDK to capture the view hierarchy now and keep it in the capture buffer, so it is in any report created afterwards. The SDK also captures it for every report on its own, at the moment the report is made, so you only need this call to get a screen that has just changed. If a frame is already scheduled (a route was just pushed), the call waits for it, up to 3 frames and 400 ms, then builds at once. + +It does nothing before `launch`, after `stop`, and when the `captureViewHierarchy` option is off. + +## Turning it off + +```dart +await Bugsee.launch( + 'YOUR_APP_TOKEN', + options: const BugseeOptions(captureViewHierarchy: false), +); +``` + +`captureViewHierarchy` is `true` by default and applies to both the native tree and the Flutter tree. + +## Freshness + +The Flutter tree is as of the last frame that changed it, plus the wait for a quiet app. Flutter draws only on a frame, so a screen that has not changed is described exactly, however old the snapshot is. A report made within about 400 ms of a change, in the middle of a scroll or an animation, or up to 3 seconds into an endless animation, can carry the screen from before the change. The root's `options.age_ms` says how old the snapshot is. + +## Limits + +- **Size.** The walk stops after 12 ms (about a third of one frame while a frame is due), 2000 nodes, 256 KiB or 512 element levels. A tree over a limit is cut, and the nodes whose children were cut carry `truncated: true`; the answer is still valid. A tree larger than the byte limit is dropped, not trimmed. A stock Material screen of about 770 nodes is not cut. +- **Debug builds are slower.** Building the tree takes several times longer in a debug build than in a profile or release build, so a large screen can be cut in debug. The integration test for the hierarchy fails in debug builds on the Android phone and the iPhone XS used in verification, and passes in profile builds. See the [FAQ](/sdk/flutter/faq). +- **One view.** Only the app's main Flutter view is described on mobile. A Flutter view that is not at the screen origin (add-to-app, split screen) is covered by unit tests, not verified on a device. +- **Several displays (Android).** The SDK does not say which display asks, so a Flutter display's tree can be served for another display's pass when nothing blanks it. The plugin serves nothing when the Flutter window has `FLAG_SECURE` (with `captureRespectFlagSecure` on, the default), during a blackout, or when it cannot tell. +- **iOS reports.** That the tree reaches an uploaded report bundle is shown on Android only; on the iOS simulator the test reads the SDK's capture buffer instead. + +## Related pages + +- [Privacy: Video](/sdk/flutter/privacy/video): `BugseeSecureView` and blackout. +- [Privacy overview](/sdk/flutter/privacy/overview): what a report can contain. +- [Configuration](/sdk/flutter/configuration): the full option list. diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 004d22e4..82763839 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -123,6 +123,13 @@ const config: Config = { { from: '/sdk/react-native/v6/privacy', to: '/sdk/react_native/v6/privacy/overview/' }, { from: '/sdk/react_native/v6', to: '/sdk/react_native/v6/installation/' }, { from: '/sdk/react_native/v6/privacy', to: '/sdk/react_native/v6/privacy/overview/' }, + // Flutter 9.x pages moved under /sdk/flutter/v9/; routes not carried over 1:1 go to the stable 9.x page. + { from: '/sdk/flutter/v9', to: '/sdk/flutter/v9/installation/' }, + { from: '/sdk/flutter/v9/privacy', to: '/sdk/flutter/v9/privacy/overview/' }, + { from: '/sdk/flutter/appearance', to: '/sdk/flutter/v9/appearance/' }, + { from: '/sdk/flutter/custom', to: '/sdk/flutter/v9/custom/' }, + { from: '/sdk/flutter/manual', to: '/sdk/flutter/v9/manual/' }, + { from: '/sdk/flutter/symbolication', to: '/sdk/flutter/v9/symbolication/' }, ], // Android 7.x and iOS 7.x lived under /sdk//v7/ until they became the // default; every current Android and iOS page keeps answering at its old v7 address. @@ -211,7 +218,7 @@ const config: Config = { { label: 'Bugsee for React Native', to: '/sdk/react_native/installation/' }, { label: 'Bugsee for Xamarin', to: '/sdk/xamarin/installation/' }, { label: 'Bugsee for .NET/MAUI', to: '/sdk/dotnet/installation/' }, - { label: 'Bugsee for Flutter', to: '/sdk/flutter/installation/' }, + { label: 'Bugsee for Flutter', to: '/sdk/flutter/v9/installation/' }, { label: 'Bugsee for Unity', to: '/sdk/unity/installation/' }, ], }, diff --git a/sidebars.ts b/sidebars.ts index d154fb65..0fe33bfb 100644 --- a/sidebars.ts +++ b/sidebars.ts @@ -1045,52 +1045,117 @@ const sidebars: SidebarsConfig = { label: "Flutter SDK", collapsed: true, items: [ + { + type: "link", + label: "Stable release (9.x) docs", + href: "/sdk/flutter/v9/installation", + }, + { type: "doc", id: "sdk/flutter/overview", label: "Overview" }, { type: "doc", id: "sdk/flutter/installation", label: "Installation" }, + { type: "doc", id: "sdk/flutter/configuration", label: "Configuration" }, + { type: "doc", id: "sdk/flutter/lifecycle", label: "Lifecycle & status" }, { - type: "doc", - id: "sdk/flutter/configuration", - label: "Configuration", + type: "category", + label: "Manual reporting", + collapsed: true, + items: [ + { type: "doc", id: "sdk/flutter/manual/bug-reporting", label: "Bug reporting" }, + { type: "doc", id: "sdk/flutter/manual/crash-error-reporting", label: "Crash & error reporting" }, + ], + }, + { type: "doc", id: "sdk/flutter/dart-errors", label: "Dart errors" }, + { type: "doc", id: "sdk/flutter/report-handler", label: "Report handler" }, + { + type: "category", + label: "Data", + collapsed: true, + items: [ + { type: "doc", id: "sdk/flutter/network", label: "Network capture" }, + { type: "doc", id: "sdk/flutter/logs", label: "Console logs" }, + { type: "doc", id: "sdk/flutter/events-and-traces", label: "Custom events & traces" }, + { type: "doc", id: "sdk/flutter/user-session-data", label: "User & session data" }, + { type: "doc", id: "sdk/flutter/view-hierarchy", label: "View hierarchy" }, + ], }, - { type: "doc", id: "sdk/flutter/manual", label: "Manual invocation" }, - { type: "doc", id: "sdk/flutter/custom", label: "Custom data" }, - { type: "doc", id: "sdk/flutter/logs", label: "Console logs" }, { type: "category", label: "Privacy", collapsed: true, items: [ + { type: "doc", id: "sdk/flutter/privacy/overview", label: "Overview" }, + { type: "doc", id: "sdk/flutter/privacy/video", label: "Video" }, + { type: "doc", id: "sdk/flutter/privacy/logs", label: "Console logs" }, + { type: "doc", id: "sdk/flutter/privacy/network", label: "Network" }, + ], + }, + { type: "doc", id: "sdk/flutter/feedback", label: "Feedback" }, + { + type: "category", + label: "Crash symbolication", + collapsed: true, + items: [ + { type: "doc", id: "sdk/flutter/symbolication/overview", label: "Overview" }, + { type: "doc", id: "sdk/flutter/symbolication/android", label: "Android" }, + { type: "doc", id: "sdk/flutter/symbolication/ios", label: "iOS" }, + { type: "doc", id: "sdk/flutter/symbolication/dart", label: "Dart" }, + ], + }, + { type: "doc", id: "sdk/flutter/release-notes", label: "Release notes" }, + { type: "doc", id: "sdk/flutter/faq", label: "FAQ" }, + { type: "doc", id: "sdk/flutter/migration", label: "Migrating from 9.x" }, + { + type: "category", + label: "Previous versions (9.x)", + collapsed: true, + items: [ + { type: "doc", id: "sdk/flutter/v9/installation", label: "Installation" }, { type: "doc", - id: "sdk/flutter/privacy/overview", - label: "Overview", + id: "sdk/flutter/v9/configuration", + label: "Configuration", }, - { type: "doc", id: "sdk/flutter/privacy/video", label: "Video" }, + { type: "doc", id: "sdk/flutter/v9/manual", label: "Manual invocation" }, + { type: "doc", id: "sdk/flutter/v9/custom", label: "Custom data" }, + { type: "doc", id: "sdk/flutter/v9/logs", label: "Console logs" }, + { + type: "category", + label: "Privacy", + collapsed: true, + items: [ + { + type: "doc", + id: "sdk/flutter/v9/privacy/overview", + label: "Overview", + }, + { type: "doc", id: "sdk/flutter/v9/privacy/video", label: "Video" }, + { + type: "doc", + id: "sdk/flutter/v9/privacy/logs", + label: "Console logs", + }, + { + type: "doc", + id: "sdk/flutter/v9/privacy/network", + label: "Network", + }, + ], + }, + { type: "doc", id: "sdk/flutter/v9/feedback", label: "Feedback" }, + { type: "doc", id: "sdk/flutter/v9/appearance", label: "Appearance" }, + { type: "doc", id: "sdk/flutter/v9/network", label: "Network capture" }, + { type: "doc", id: "sdk/flutter/v9/lifecycle", label: "Lifecycle events" }, { type: "doc", - id: "sdk/flutter/privacy/logs", - label: "Console logs", + id: "sdk/flutter/v9/symbolication", + label: "Crash symbolication", }, { type: "doc", - id: "sdk/flutter/privacy/network", - label: "Network", + id: "sdk/flutter/v9/release-notes", + label: "Release notes", }, ], }, - { type: "doc", id: "sdk/flutter/feedback", label: "Feedback" }, - { type: "doc", id: "sdk/flutter/appearance", label: "Appearance" }, - { type: "doc", id: "sdk/flutter/network", label: "Network capture" }, - { type: "doc", id: "sdk/flutter/lifecycle", label: "Lifecycle events" }, - { - type: "doc", - id: "sdk/flutter/symbolication", - label: "Crash symbolication", - }, - { - type: "doc", - id: "sdk/flutter/release-notes", - label: "Release notes", - }, ], }, {