diff --git a/contents/docs/error-tracking/installation/flutter.mdx b/contents/docs/error-tracking/installation/flutter.mdx index 28080fcb8af9..4974b77d0563 100644 --- a/contents/docs/error-tracking/installation/flutter.mdx +++ b/contents/docs/error-tracking/installation/flutter.mdx @@ -7,6 +7,11 @@ tableOfContents: [ value: 'Install PostHog Flutter SDK', depth: 1, }, + { + url: 'set-up-exception-autocapture', + value: 'Set up exception autocapture', + depth: 1, + }, { url: 'manually-capture-exceptions', value: 'Manually capture exceptions', @@ -23,17 +28,20 @@ tableOfContents: [ import { Steps, Step } from 'components/Docs/Steps' import { CalloutBox } from 'components/Docs/CalloutBox' -import InstallFlutter from "../../integrate/_snippets/install-flutter.mdx" +import InstallFlutter from "../../integrate/_snippets/install-flutter-manual.mdx" import StepVerifyErrorTracking from "./_snippets/step-verify-error-tracking.mdx" We currently don't support the following features: -- Automatic exception capture -- De-obfuscating stacktraces from obfuscated builds ([--obfuscate](https://docs.flutter.dev/deployment/obfuscate) and [--split-debug-info](https://docs.flutter.dev/deployment/obfuscate)) -- [Source code context](/docs/error-tracking/stack-traces) associated with an exception -- Flutter web support +- No de-obfuscating stacktraces from obfuscated builds ([--obfuscate](https://docs.flutter.dev/deployment/obfuscate) and [--split-debug-info](https://docs.flutter.dev/deployment/obfuscate)) for Dart code +- No de-obfuscating stacktraces when [isMinifyEnabled](https://developer.android.com/topic/performance/app-optimization/enable-app-optimization) is enabled for Java/Kotlin code +- No [Source code context](/docs/error-tracking/stack-traces) associated with an exception +- No native iOS exception capture +- No native C/C++ exception capture on Android (Java/Kotlin only) +- No background isolate error capture +- No Flutter web support These features will be added in future releases. @@ -45,7 +53,7 @@ These features will be added in future releases. -A minimum SDK version of [5.7.0](https://github.com/PostHog/posthog-flutter/releases/tag/5.7.0) is required, but we recommend [keeping up to date with the latest version](/docs/sdk-doctor) to ensure you have all of error tracking's features. +A minimum SDK version of [5.9.0](https://github.com/PostHog/posthog-flutter/releases/tag/5.9.0) is required, but we recommend [keeping up to date with the latest version](/docs/sdk-doctor) to ensure you have all of error tracking's features. @@ -53,6 +61,39 @@ A minimum SDK version of [5.7.0](https://github.com/PostHog/posthog-flutter/rele + + + + +This configuration is client-side only. Support for remote configuration in the [error tracking settings](https://app.posthog.com/settings/project-error-tracking#exception-autocapture) will be added in a future release. + + + +You can autocapture exceptions by configuring the `errorTrackingConfig` when setting up PostHog: + +```dart +final config = PostHogConfig(''); + +// Enable exception autocapture +config.errorTrackingConfig.captureFlutterErrors = true; +config.errorTrackingConfig.capturePlatformDispatcherErrors = true; +config.errorTrackingConfig.captureIsolateErrors = true; +config.errorTrackingConfig.captureNativeExceptions = true; // Android only +config.errorTrackingConfig.captureSilentFlutterErrors = false; + +await Posthog().setup(config); +``` + +**Configuration options:** + +- **`captureFlutterErrors`**: Captures Flutter framework errors (FlutterError.onError) +- **`capturePlatformDispatcherErrors`**: Captures Dart runtime errors (PlatformDispatcher.onError) +- **`captureIsolateErrors`**: Captures errors from main isolate +- **`captureNativeExceptions`**: Captures native exceptions (Android only - Java/Kotlin exceptions) +- **`captureSilentFlutterErrors`**: Captures Flutter errors that are marked as silent (default: false) + + + ### Basic usage diff --git a/contents/docs/libraries/flutter/index.mdx b/contents/docs/libraries/flutter/index.mdx index 4a264c1c04c2..f920f77d4085 100644 --- a/contents/docs/libraries/flutter/index.mdx +++ b/contents/docs/libraries/flutter/index.mdx @@ -159,6 +159,10 @@ if (await Posthog().getFeatureFlag('experiment-feature-flag-key') == 'variant-na It's also possible to [run experiments without using feature flags](/docs/experiments/running-experiments-without-feature-flags). +## Error tracking + +To set up error tracking in your project, follow the [Flutter installation guide](/docs/error-tracking/installation/flutter). + ## Session replay > **Note:** Session replay is supported on the Flutter Web, Android and iOS environments.