Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SDKs and their associated integrations will automatically record many types of breadcrumbs. For instance, the browser JavaScript SDK will automatically record all location changes.
20 changes: 20 additions & 0 deletions src/includes/breadcrumbs/automatic-breadcrumbs/flutter.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The Flutter SDK already captures breadcrumbs automatically via the Native SDKs.

- [Automatic Breadcrumbs for Android](/platforms/android/enriching-events/breadcrumbs/#automatic-breadcrumbs)
- [Automatic Breadcrumbs for iOS](/platforms/apple/usage/#sentryautobreadcrumbtrackingintegration)

If you wish to add additional Navigation breadcrumbs for Flutter Apps, Add the `SentryNavigatorObserver` to your `MaterialApp`, `WidgetsApp` or `CupertinoApp`

```dart
import 'package:flutter/material.dart';
import 'package:sentry_flutter/sentry_flutter.dart';

MaterialApp(
navigatorObservers: [
SentryNavigatorObserver(),
],
// other parameters
)
```

To track automatic Breadcrumbs for `HTTP` requests, Check out the [SentryHttpClient](/platforms/dart/usage/advanced-usage/#automatic-breadcrumbs) Wrapper for the [http](https://pub.dev/packages/http) library.
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ SentryXamarin.Init(options =>
? null
: breadcrumb;
});
```
```
10 changes: 10 additions & 0 deletions src/includes/capture-error/flutter.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<PlatformContent includePath="capture-error/dart.mdx" />

## Tips for Catching Errors

- Use a `try/catch` block
- Use a `catchError` block for `Futures`
- The SDK already runs your init `callback` on an error handler, such as using `runZonedGuarded`, are captured automatically
- Flutter-specific errors, such as using `FlutterError.onError`, are captured automatically
- `Isolate` errors on the `current` Isolate which is the equivalent of a main/UI thread, such as using `Isolate.current.addErrorListener`, are captured automatically (only for non-Web Apps).
- For your own `Isolates`, add an `ErrorListener` and call `Sentry.captureException`
2 changes: 0 additions & 2 deletions src/includes/configuration/decluttering/android.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
### Decluttering Sentry

When used together with one of the logging framework integrations, the Android SDK captures all error logs as events. If you see a particular kind of error very often that has a `logger` tag, you can ignore that particular logger entirely. For more information see our <Link to="/platforms/android/integrations/timber/">Timber</Link> integration.
2 changes: 0 additions & 2 deletions src/includes/configuration/decluttering/java.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
### Decluttering Sentry

When used together with one of the logging framework integrations, the Java SDK captures all error logs as events. If you see a particular kind of error very often that has a `logger` tag, you can ignore that particular logger entirely. For more information see our <Link to="/platforms/java/guides/logback/">Logback</Link> or <Link to="/platforms/java/guides/log4j2/">Log4j 2.x</Link> integration.
2 changes: 0 additions & 2 deletions src/includes/configuration/decluttering/javascript.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
### Decluttering Sentry

You can construct an allowed list of domains which might raise acceptable exceptions. For example, if your scripts are loaded from `cdn.example.com` and your site is `example.com`, you can set `allowUrls` to:

```javascript
Expand Down
2 changes: 0 additions & 2 deletions src/includes/configuration/decluttering/python.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
### Decluttering Sentry

By default the Python SDK captures all error logs as events. If you see a particular kind of error very often that has a `logger` tag, you can ignore that particular logger entirely. For more information see our <Link to="/platforms/python/guides/logging/">logging integration</Link>.
2 changes: 2 additions & 0 deletions src/includes/getting-started-config/flutter.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ Future<void> main() async {
// or define SENTRY_DSN via Dart environment variable (--dart-define)
}
```

You can configure the `SENTRY_DSN`, `SENTRY_RELEASE`, `SENTRY_DIST` and `SENTRY_ENVIRONMENT` via the Dart environment variables passing the `--dart-define` flag to the compiler as noted in the code sample.
19 changes: 16 additions & 3 deletions src/includes/getting-started-primer/flutter.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
<Note>

_Sentry's Flutter SDK enables capturing sessions for Release Health, offline caching as well as reporting messages and errors._

_Sentry's Flutter SDK depends on the [Dart SDK](/platforms/dart/) and includes support to native crashes through Sentry's native SDKs (Android and iOS), It'll capture errors in the native layer, including Java, Kotlin, C and C++ code for `Android` and ObjC, Swift and C for `iOS`._
_Sentry's Flutter SDK enables automatic reporting of errors, messages, and exceptions. The SDK is available on GitHub [`sentry-dart`](https://github.com/getsentry/sentry-dart/)._

</Note>

Features:

- Automatic native crash error tracking (using both [Android](/platforms/android/) and [iOS](/platforms/apple/)), including
Copy link
Contributor

Choose a reason for hiding this comment

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

we also Support Flutter Web, it's a bit limited compared to Android and iOS, of course.
Eg, events are not enriched with device context.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added "Limited Support for Flutter Web" - LMK if there's a link to add or if that wording is quite what we want here @bruno-garcia

Copy link
Contributor

Choose a reason for hiding this comment

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

sounds good to me, so we don't create much expectations from Web devs as we didn't spend time on it

- Java, Kotlin, C, and C++ code for Android
- ObjC, Swift, and C for iOS
- Offline storage of events
- Events [enriched](/platforms/flutter/enriching-events/context/) with device data
- Breadcrumbs automatically captured:
- by the [Flutter SDK](/platforms/flutter/enriching-events/breadcrumbs/#automatic-breadcrumbs)
- via the Native SDKs [Automatic Breadcrumbs for Android](/platforms/android/enriching-events/breadcrumbs/#automatic-breadcrumbs) and [Automatic Breadcrumbs for iOS](/platforms/apple/usage/#sentryautobreadcrumbtrackingintegration)
- as well as `http` with the [Dart SDK](/platforms/dart/)
- [Release Health](/product/releases/health/) tracks crash free users and sessions
- Limited support for Flutter Web
- Under the hood the SDK relies on the [Dart SDK](/platforms/dart/); the minimum required version is `2.8.0` and Flutter SDK version is `1.17.0`.
1 change: 1 addition & 0 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const HIGHLIGHTED_PLATFORMS = [
"apple",
"java.spring-boot",
"ruby.rails",
"flutter",
];

const IndexPage = () => {
Expand Down
9 changes: 8 additions & 1 deletion src/platforms/common/configuration/filtering.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,18 @@ In this example, the fingerprint is forced to a common value if an exception of

: For breadcrumbs created from HTTP requests done via the legacy `XMLHttpRequest` API. This holds the original xhr object.

</PlatformSection>

<PlatformSection supported={["android", "javascript", "java", "python"]} >

### Decluttering Sentry

<PlatformContent includePath="configuration/decluttering" />

</PlatformSection>

<PlatformSection supported={["javascript", "node", "python", "go", "dotnet"]} notSupported={["javascript.cordova"]}>

<PlatformSection supported={["node", "javascript", "python", "php", "dotnet", "java", "ruby", "go", "react-native", "android", "dotnet"]} notSupported={["javascript.cordova", "flutter"]}>

## Using Sampling to Filter Transaction Events

Expand Down
16 changes: 10 additions & 6 deletions src/platforms/common/configuration/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ will be sent. This is a "contains" match to the entire file URL. As a result, if

</ConfigKey>

<ConfigKey name="auto-session-tracking" supported={["javascript"]}>
<ConfigKey name="auto-session-tracking" supported={["javascript", "flutter"]} >

When set to `true`, the SDK will send session events to Sentry. This is supported in all browser SDKs, emitting one session per pageload and page navigation to Sentry.

Expand Down Expand Up @@ -203,7 +203,7 @@ Sentry SDKs normalize any contextual data to a given depth. Any keys containing

</ConfigKey>

<PlatformSection supported={["javascript", "python", "node"]}>
<PlatformSection supported={["javascript", "python", "node", "flutter"]}>

## Integration Configuration

Expand Down Expand Up @@ -236,13 +236,13 @@ The callback typically gets a second argument (called a "hint") which contains t

</ConfigKey>

<PlatformSection supported={["javascript", "java", "python", "node", "php", "dotnet"]}>
<PlatformSection supported={["javascript", "java", "python", "node", "php", "dotnet", "flutter"]}>

## Transport Options

Transports are used to send events to Sentry. Transports can be customized to some degree to better support highly specific deployments.

<ConfigKey name="transport" supported={["javascript", "php", "python", "java", "dotnet"]}>
<ConfigKey name="transport" supported={["javascript", "php", "python", "java", "dotnet", "flutter"]}>

Switches out the transport used to send events. How this works depends on the SDK. It can, for instance, be used to capture events for unit-testing or to send it through some more complex setup that requires proxy authentication.

Expand Down Expand Up @@ -284,16 +284,20 @@ Controls how many seconds to wait before shutting down. Sentry SDKs send events

</PlatformSection>

<PlatformSection supported={["node", "javascript", "python", "php", "dotnet", "java", "ruby", "go", "react-native", "android", "dotnet"]}>

## Tracing Options

<ConfigKey name="traces-sample-rate" supported={["node", "javascript", "python", "php", "dotnet"]}>
<ConfigKey name="traces-sample-rate" supported={["node", "javascript", "python", "php", "dotnet", "java", "ruby", "go", "react-native", "android", "dotnet"]}>

A number between 0 and 1, controlling the percentage chance a given transaction will be sent to Sentry. (0 represents 0% while 1 represents 100%.) Applies equally to all transactions created in the app. Either this or <PlatformIdentifier name="traces-sampler" /> must be defined to enable tracing.

</ConfigKey>

<ConfigKey name="traces-sampler" supported={["node", "javascript", "python", "php", "dotnet"]}>
<ConfigKey name="traces-sampler" supported={["node", "javascript", "python", "php", "dotnet", "java", "ruby", "go", "react-native", "android", "dotnet"]}>

A function responsible for determining the percentage chance a given transaction will be sent to Sentry. It will automatically be passed information about the transaction and the context in which it's being created, and must return a number between `0` (0% chance of being sent) and `1` (100% chance of being sent). Can also be used for filtering transactions, by returning 0 for those that are unwanted. Either this or <PlatformIdentifier name="traces-sample-rate" /> must be defined to enable tracing.

</ConfigKey>

</PlatformSection>
6 changes: 3 additions & 3 deletions src/platforms/common/enriching-events/breadcrumbs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Developers who want to modify the breadcrumbs interface can read about this in d

You can manually add breadcrumbs whenever something interesting happens. For example, you might manually record a breadcrumb if the user authenticates or another state change happens.

<PlatformContent includePath="breadcrumbs-example" />
<PlatformContent includePath="breadcrumbs/breadcrumbs-example" />

<PlatformSection supported={["javascript", "node", "python", "php", "ruby", "elixir", "perl", "native"]}>

Expand All @@ -36,13 +36,13 @@ The available breadcrumb keys are `type`, `category`, `message`, `level`, `times

## Automatic Breadcrumbs

SDKs and their associated integrations will automatically record many types of breadcrumbs. For instance, the browser JavaScript SDK will automatically record all location changes.
<PlatformContent includePath="breadcrumbs/automatic-breadcrumbs" />

## Customize Breadcrumbs

SDKs allow you to customize breadcrumbs through the `before_breadcrumb` hook. This hook is passed an already assembled breadcrumb and, in some SDKs, an optional hint. The function can modify the breadcrumb or decide to discard it entirely by returning `null`:

<PlatformContent includePath="before-breadcrumb" />
<PlatformContent includePath="breadcrumbs/before-breadcrumb" />

For information about what can be done with the hint, see <PlatformLink to="/enriching-events/breadcrumbs/">Filtering Events</PlatformLink>.

Expand Down
1 change: 1 addition & 0 deletions src/platforms/common/enriching-events/scopes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ notSupported:
- php
- php.laravel
- php.symfony
- flutter
---

When an event is captured and sent to Sentry, SDKs will merge that event data with extra
Expand Down
2 changes: 1 addition & 1 deletion src/platforms/common/enriching-events/tags.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ description: "Tags power UI features such as filters and tag-distribution maps.

We’ll automatically index all tags for an event, as well as the frequency and the last time that Sentry has seen a tag. We also keep track of the number of distinct tags and can assist you in determining hotspots for various issues.

<PlatformSection notSupported={["native.minidumps", "native.wasm", "php", "php.laravel", "php.symfony"]}>
<PlatformSection notSupported={["native.minidumps", "native.wasm", "php", "php.laravel", "php.symfony", "flutter"]}>

Defining tags is easy, and will bind them to the [current scope](../scopes/) ensuring all future events within scope contain the same tags:

Expand Down
23 changes: 0 additions & 23 deletions src/platforms/flutter/index.mdx

This file was deleted.

59 changes: 7 additions & 52 deletions src/platforms/flutter/usage/advanced-usage.mdx
Original file line number Diff line number Diff line change
@@ -1,39 +1,16 @@
---
title: Advanced Usage
sidebar_order: 2
description: "Learn about advanced uses of the Flutter SDK, including uploading debug symbols, known limitations, and bundling."
---

## Requirements

For the usage of the Flutter SDK, the minimal required Dart SDK version is `2.8.0` and Flutter SDK version is `1.17.0`

## Automatic Breadcrumbs

The Flutter SDK already captures breadcrumbs automatically via the Native SDKs.

- [Automatic Breadcrumbs for Android](/platforms/android/enriching-events/breadcrumbs/#automatic-breadcrumbs)
- [Automatic Breadcrumbs for iOS](/platforms/apple/usage/#sentryautobreadcrumbtrackingintegration)

If you wish to add additional Navigation breadcrumbs for Flutter Apps, Add the `SentryNavigatorObserver` to your `MaterialApp`, `WidgetsApp` or `CupertinoApp`

```dart
import 'package:flutter/material.dart';
import 'package:sentry_flutter/sentry_flutter.dart';

MaterialApp(
navigatorObservers: [
SentryNavigatorObserver(),
],
// other parameters
)
```

To track automatic Breadcrumbs for `HTTP` requests, Check out the [SentryHttpClient](/platforms/dart/usage/advanced-usage/#automatic-breadcrumbs) Wrapper for the [http](https://pub.dev/packages/http) library.

## Uploading Debug Symbols (Android and iOS)

Debug symbols provide information that Sentry displays on the Issue Details page to help you triage an issue.

- [iOS dSYM files](/platforms/apple/dsym/)
- [Android NDK](/product/cli/dif/#uploading-files), You've to do it manually, Do not use the `uploadNativeSymbols` flag from the [Sentry Gradle Plugin](/platforms/android/proguard/), it's not supported yet.
- [Android NDK](/product/cli/dif/#uploading-files) need to be done manually. Do not use the `uploadNativeSymbols` flag from the [Sentry Gradle Plugin](/platforms/android/proguard/) as it is not yet supported.
- [Android Proguard/R8 mapping file](/platforms/android/proguard/)
- [Source maps for Flutter Web](/product/cli/releases/#managing-release-artifacts)

Expand All @@ -42,35 +19,13 @@ To track automatic Breadcrumbs for `HTTP` requests, Check out the [SentryHttpCli
- Flutter `split-debug-info` and `obfuscate` flags aren't yet supported on iOS; they are supported only on Android. If this feature is enabled, Dart stack traces are not human readable, this is a tooling limitation, See: [43612](https://github.com/dart-lang/sdk/issues/43612) and [43274](https://github.com/dart-lang/sdk/issues/43274).
- If you enable the `split-debug-info` feature, you must upload the Debug Symbols manually.
- Also, Issue's titles might be obfuscated as we rely on the `runtimeType`, but they may not be human-readable, See: [Obfuscate Caveat](https://flutter.dev/docs/deployment/obfuscate#caveat)
- Layout related errors are only caught by [FlutterError.onError](https://api.flutter.dev/flutter/foundation/FlutterError/onError.html) in debug mode. In release mode, they are removed by the Flutter framework. See [Flutter build modes](https://flutter.dev/docs/testing/build-modes).

## Tips for Catching Errors

- Use a `try/catch` block
- Use a `catchError` block for `Futures`
- The SDK already runs your init `callback` on an error handler, e.g. using `runZonedGuarded`, are captured automatically
- Flutter-specific errors, e.g. using `FlutterError.onError`, are captured automatically
- `Isolate` errors on the `current` Isolate which is the equivalent of a main/UI thread, e.g. using `Isolate.current.addErrorListener`, are captured automatically (Only for non-Web Apps).
- For your own `Isolates`, add an `ErrorListener` and call `Sentry.captureException`

## Caveat

Always prefer the `SentryFlutter.init(...)` instead of `Sentry.init(...)` as it adds the Flutter integrations on top of the Dart SDK.

## Advanced Usage (Android and iOS)

- [iOS Advanced Usage](/platforms/apple/usage/)
- [Android Advanced Usage](/platforms/android/usage/advanced-usage/)

## Dart environment variables

- You can configure the `SENTRY_DSN`, `SENTRY_RELEASE`, `SENTRY_DIST` and `SENTRY_ENVIRONMENT` via the Dart environment variables passing the `--dart-define` flag to the compiler.
- Layout related errors are only caught by [FlutterError.onError](https://api.flutter.dev/flutter/foundation/FlutterError/onError.html) in debug mode. In release mode, they are removed by the Flutter framework. See [Flutter build modes](https://flutter.dev/docs/testing/build-modes).

## Building specific ABI on Android
## Building Specific ABI on Android

The Sentry Flutter SDK includes the Sentry Android SDK, which bundles multiple native libraries for multiple ABIs.
Building a Flutter app for a specific ABI using the `--target-platform` argument, for example an ARM 32bit apk, looks like this, which should also include the `--split-per-abi` flag:

```sh
```bash
flutter build apk --target-platform=android-arm --split-per-abi
```
12 changes: 9 additions & 3 deletions src/wizard/flutter/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ support_level: production
type: framework
---

Get the SDK from [pub.dev](https://pub.dev/packages/sentry_flutter) by adding the following to your `pubspec.yaml`:
Sentry captures data by using an SDK within your application’s runtime. Add the following to your `pubspec.yaml`:

```yml {filename:pubspec.yaml}
dependencies:
Expand All @@ -25,10 +25,12 @@ Future<void> main() async {
},
appRunner: () => runApp(MyApp()),
);
}

// or define SENTRY_DSN via Dart environment variable (--dart-define)
}
```

Capture a test exception:
Then create an intentional error, so you can test that everything is working:

```dart
import 'package:sentry/sentry.dart';
Expand All @@ -42,3 +44,7 @@ try {
);
}
```

If you're new to Sentry, use the email alert to access your account and complete a product tour.

If you're an existing user and have disabled alerts, you won't receive this email.