-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(flutter): docs for setting up flutter web for chrome extensions #14474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
buenaflor
merged 9 commits into
master
from
cursor/set-up-flutter-web-for-chrome-extensions-1df2
Oct 30, 2025
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
584aed8
Add Flutter Chrome Extensions configuration guide for Sentry
cursoragent 1d5ce15
Update chrome-extensions.mdx
buenaflor c8ec7f8
Update chrome-extensions.mdx
buenaflor 7685893
Merge branch 'master' into cursor/set-up-flutter-web-for-chrome-exten…
buenaflor b2f9add
Update
buenaflor 4626523
Update
buenaflor 6debc04
Update
buenaflor 113730e
Update chrome-extensions.mdx
buenaflor 3a4a96a
Update chrome-extensions.mdx
buenaflor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
docs/platforms/dart/guides/flutter/configuration/chrome-extensions.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| --- | ||
| title: Chrome Extensions | ||
| description: "Learn how to set up the Sentry Flutter SDK for Chrome Extensions with Flutter Web." | ||
| sidebar_order: 500 | ||
| sdk: sentry.dart.flutter | ||
| categories: | ||
| - dart | ||
| - flutter | ||
| --- | ||
|
|
||
| <Alert level="warning"> | ||
|
|
||
| Chrome Extensions enforce strict Content Security Policy (CSP) rules that prevent dynamically loaded scripts. The standard Sentry Flutter SDK setup will not work in Chrome Extension environments without the modifications outlined in this guide. | ||
|
|
||
| </Alert> | ||
|
|
||
| ## Overview | ||
|
|
||
| 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. | ||
|
|
||
| ## Required Setup | ||
|
|
||
| ### 1. Download the Sentry JavaScript Bundle | ||
|
|
||
| Instead of loading the Sentry JavaScript SDK dynamically, you need to include it as a static asset: | ||
|
|
||
| 1. Download the minified Sentry JavaScript bundle from the Sentry CDN. Use the version that is compatible with the Sentry Flutter SDK: | ||
| ``` | ||
| https://browser.sentry-cdn.com/9.40.0/bundle.tracing.min.js | ||
buenaflor marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| <Alert level="info"> | ||
|
|
||
| Replace `9.40.0` 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. | ||
|
|
||
| </Alert> | ||
|
|
||
| 2. Save this file to your Flutter Web project's `web/` directory. | ||
|
|
||
| ### 2. Include the Script in Your HTML | ||
|
|
||
| Add the Sentry JavaScript bundle to your `web/index.html` file: | ||
|
|
||
| ```html {filename:web/index.html} | ||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <!-- Other head elements --> | ||
| <script src="bundle.tracing.min.js" type="application/javascript"></script> | ||
| </head> | ||
| <body> | ||
| <!-- Your app content --> | ||
| </body> | ||
| </html> | ||
| ``` | ||
|
|
||
| ### 3. Configure Your Flutter Build | ||
|
|
||
| Build your Flutter Web app for Chrome Extensions. | ||
|
|
||
| Ensure that the `bundle.tracing.min.js` file is included in your `web/` directory before building. | ||
|
|
||
| ### 4. Upload Source Maps | ||
|
|
||
| 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/). | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.