Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 47 additions & 6 deletions contents/docs/error-tracking/installation/flutter.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Show manual installation instructions

import StepVerifyErrorTracking from "./_snippets/step-verify-error-tracking.mdx"

<CalloutBox icon="IconInfo" title="Planned features" type="fyi">

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))
- 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.

Expand All @@ -45,14 +53,47 @@ These features will be added in future releases.

<CalloutBox icon="IconInfo" title="SDK version requirement" type="action">

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.

</CalloutBox>

<InstallFlutter />

</Step>

<Step title="Set up exception autocapture" badge="recommended">

<CalloutBox icon="IconInfo" title="Client-side configuration only" type="fyi">

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.

</CalloutBox>

You can autocapture exceptions by configuring the `errorTrackingConfig` when setting up PostHog:

```dart
final config = PostHogConfig('<ph_project_api_key>');

// 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)

</Step>

<Step title="Manually capture exceptions" badge="optional">

### Basic usage
Expand Down
4 changes: 4 additions & 0 deletions contents/docs/libraries/flutter/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down