You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: "Learn how to set up the Sentry Flutter SDK for Chrome Extensions with Flutter Web."
4
+
sidebar_order: 500
5
+
sdk: sentry.dart.flutter
6
+
categories:
7
+
- dart
8
+
- flutter
9
+
---
10
+
11
+
## Overview
12
+
13
+
Chrome Extensions enforce strict Content Security Policy (CSP) rules that prevent dynamically loaded scripts. Since the Sentry Flutter SDK typically loads the Sentry JavaScript SDK dynamically for web platforms, you need to include the Sentry JavaScript bundle as a static asset instead.
14
+
15
+
## Required Setup
16
+
17
+
### 1. Download the Sentry JavaScript Bundle
18
+
19
+
Instead of loading the Sentry JavaScript SDK dynamically, you need to include it as a static asset:
20
+
21
+
1. Download the minified Sentry JavaScript bundle from the Sentry CDN. Use the version that is compatible with the Sentry Flutter SDK:
Download the Sentry Javascript bundle with the appropriate version for your project. Check the [Sentry Flutter SDK releases](https://github.com/getsentry/sentry-dart/releases) to find the version of the Sentry Javascript SDK that is used in a specific Sentry Flutter SDK release.
27
+
28
+
</Alert>
29
+
30
+
2. Save this file to your Flutter Web project's `web/` directory.
31
+
32
+
### 2. Include the Script in Your HTML
33
+
34
+
Add the Sentry JavaScript bundle to your `web/index.html` file:
Ensure that the `bundle.tracing.min.js` file is included in your `web/` directory before building.
54
+
55
+
### 4. Upload Source Maps
56
+
57
+
After building your application, upload the generated source maps to Sentry to enable proper symbolication of stack traces using the [sentry_dart_plugin](/platforms/dart/guides/flutter/debug-symbols/dart-plugin/).
@@ -52,12 +55,17 @@ For more information, read the [Sentry Dart Plugin README](https://github.com/ge
52
55
53
56
Before running the plugin, build your Flutter application with one of the following commands. Obfuscated is encouraged for production builds, and will make uploading debug symbols necessary to get readable stack traces.
54
57
58
+
<Alert>
59
+
The `--extra-gen-snapshot-options=--save-obfuscation-map=build/app/obfuscation.map.json` option is required to generate the symbol map file which is used to make the obfuscated Flutter issue titles readable on iOS and Android.
60
+
Make sure to set the `dart_symbol_map_path` option in your `pubspec.yaml` file to the path of the `obfuscation.map.json` file.
flutter build windows --obfuscate --split-debug-info=<output-directory> --extra-gen-snapshot-options=--save-obfuscation-map=build/app/obfuscation.map.json
68
+
flutter build linux --obfuscate --split-debug-info=<output-directory> --extra-gen-snapshot-options=--save-obfuscation-map=build/app/obfuscation.map.json
61
69
```
62
70
63
71
```bash {tabTitle: Flutter Web}
@@ -83,7 +91,7 @@ If you don't obfuscate your build, the plugin won't upload debug symbols. Additi
83
91
84
92
## Android ProGuard Integration
85
93
86
-
If you have ProGuard (`minifyEnabled`) enabled, you must upload Android Proguard/R8 mapping files. You have two options:
94
+
If you have ProGuard (`minifyEnabled`) enabled and you want to see proper native Android stacktraces, you must upload Android Proguard/R8 mapping files. You have two options:
87
95
88
96
1.**Use the Sentry Android Gradle Plugin (Recommended)**
89
97
@@ -125,6 +133,7 @@ The following table lists all available configuration options for the Sentry Dar
125
133
|`upload_debug_symbols`| boolean |`true`| Enables or disables automatic upload of debug symbols ||
126
134
|`upload_source_maps`| boolean |`false`| Enables or disables automatic upload of source maps ||
127
135
|`upload_sources`| boolean |`false`| Enables or disables source code upload ||
136
+
|`dart_symbol_map_path`| string || Absolute or relative path to the Dart symbol map file used to make obfuscated Flutter issue titles readable on iOS and Android ||
128
137
|`url`| string || The URL of your Sentry instance |`SENTRY_URL`|
129
138
|`url_prefix`| URL prefix for JS source maps | e.g. ~/app/ (string) | no | - |
130
139
|`wait_for_processing`| boolean |`false`| Whether to wait for server-side processing of uploaded files ||
@@ -52,12 +55,17 @@ For more information, read the [Sentry Dart Plugin README](https://github.com/ge
52
55
53
56
Before running the plugin, build your Flutter application with one of the following commands. Obfuscated is encouraged for production builds, and will make uploading debug symbols necessary to get readable stack traces.
54
57
58
+
<Alert>
59
+
The `--extra-gen-snapshot-options=--save-obfuscation-map=build/app/obfuscation.map.json` option is required to generate the symbol map file which is used to make the obfuscated Flutter issue titles readable on iOS and Android.
60
+
Make sure to set the `dart_symbol_map_path` option in your `pubspec.yaml` file to the path of the `obfuscation.map.json` file.
flutter build windows --obfuscate --split-debug-info=<output-directory> --extra-gen-snapshot-options=--save-obfuscation-map=build/app/obfuscation.map.json
68
+
flutter build linux --obfuscate --split-debug-info=<output-directory> --extra-gen-snapshot-options=--save-obfuscation-map=build/app/obfuscation.map.json
61
69
```
62
70
63
71
```bash {tabTitle: Flutter Web}
@@ -125,6 +133,7 @@ The following table lists all available configuration options for the Sentry Dar
125
133
|`upload_debug_symbols`| boolean |`true`| Enables or disables automatic upload of debug symbols ||
126
134
|`upload_source_maps`| boolean |`false`| Enables or disables automatic upload of source maps ||
127
135
|`upload_sources`| boolean |`false`| Enables or disables source code upload ||
136
+
|`dart_symbol_map_path`| string || Absolute or relative path to the Dart symbol map file used to make obfuscated Flutter issue titles readable on iOS and Android ||
128
137
|`url`| string || The URL of your Sentry instance |`SENTRY_URL`|
129
138
|`url_prefix`| URL prefix for JS source maps | e.g. ~/app/ (string) | no | - |
130
139
|`wait_for_processing`| boolean |`false`| Whether to wait for server-side processing of uploaded files ||
0 commit comments