sentry_dart_plugin 2.0.0 copy "sentry_dart_plugin: ^2.0.0" to clipboard
sentry_dart_plugin: ^2.0.0 copied to clipboard

A Dart Build Plugin that uploads symbols for Android, iOS/macOS, and Web to Sentry via sentry-cli.

Sentry Dart Plugin #

Sentry Dart Plugin pub package pub points

A Dart Build Plugin that uploads debug symbols for Android, iOS/macOS and source maps for Web to Sentry via sentry-cli.

For doing it manually, please follow our docs.

📋 Install #

In your pubspec.yaml, add sentry_dart_plugin as a new dev dependency.

dev_dependencies:
  sentry_dart_plugin: ^1.0.0

Build App #

The flutter build apk, flutter build ios (or macos) or flutter build web is required before executing the sentry_dart_plugin plugin, because the build spits out the debug symbols and source maps.

Run #

Dart #

dart run sentry_dart_plugin

Flutter #

flutter packages pub run sentry_dart_plugin

Configuration (Optional) #

This tool comes with a default configuration. You can configure it to suit your needs. By default the plugin will look for the Sentry configuration in the pubspec.yaml file. If the configuration doesn't exist, the plugin will look for a sentry.properties file. If the sentry.properties file doesn't exist, the plugin will look for environment variables.

pubspec.yaml #

Add sentry: configuration at the end of your pubspec.yaml file:

sentry:
  upload_debug_symbols: true
  upload_source_maps: false
  upload_sources: false
  project: ...
  org: ...
  auth_token: ...
  url: ...
  wait_for_processing: false
  log_level: error # possible values: trace, debug, info, warn, error
  release: ...
  dist: ...
  web_build_path: ...
  commits: auto
  ignore_missing: true

You can also override or extend your file based configuration by passing the parameters as arguments in the format --sentry-define=<KEY>=<VALUE>. They take precedence over your file based parameters, but not over the alternative environment variables.

flutter packages pub run sentry_dart_plugin --sentry-define=release=app-internal-test@0.0.1

sentry.properties #

Create a sentry.properties file at the root of your project:

upload_debug_symbols=true
upload_source_maps=false
upload_sources=false
project=...
org=...
auth_token=...
url=...
wait_for_processing=false
log_level=error # possible values: trace, debug, info, warn, error
release=...
dist=...
web_build_path=...
commits=auto
ignore_missing=true

Available Configuration Fields #

Configuration Name Description Default Value And Type Required Alternative Environment variable
upload_debug_symbols Enables or disables the automatic upload of debug symbols true (boolean) no -
upload_source_maps Enables or disables the automatic upload of source maps false (boolean) no -
upload_sources Does or doesn't include the source code of native code false (boolean) no -
project Project's name e.g. sentry-flutter (string) yes SENTRY_PROJECT
org Organization's slug e.g. sentry-sdks (string) yes SENTRY_ORG
auth_token Auth Token e.g. 64 random characteres (string) yes SENTRY_AUTH_TOKEN
url URL e.g. https://mysentry.invalid/ (string) no SENTRY_URL
wait_for_processing Wait for server-side processing of uploaded files false (boolean) no -
log_level Configures the log level for sentry-cli warn (string) no SENTRY_LOG_LEVEL
release The release version for source maps, it should match the release set by the SDK default: name@version from pubspec (string) no SENTRY_RELEASE
dist The dist/build number for source maps, it should match the dist set by the SDK default: the number after the '+' char from 'version' pubspec (string) no SENTRY_DIST
web_build_path The web build folder default: build/web (string) no -
commits Release commits integration default: auto no -
ignore_missing Ignore missing commits previously used in the release default: false no -
bin_dir The folder where the plugin downloads the sentry-cli binary .dart_tool/pub/bin/sentry_dart_plugin (string) no -
bin_path Path to the sentry-cli binary to use instead of downloading. Make sure to use the correct version. null (string) no -

Release #

Per default, the release is build from pubspec.yaml's name, version & build: name@version+build. The build number, if present, is used as the dist parameter.

You can override these values by providing a release and dist through the plugin config, or through environmental values. The latter have precedence over the former. A custom dist value will also be used as the build number.

If provided, the plugin will take your release and dist values without further mutating them. Make sure you configure everything as outlined in the release docs of sentry-cli.

Troubleshooting #

Sentry's auth_token requires the project:releases or project:write scope, See docs.

For the commits feature, Sentry's auth_token also requires the org:read scope, See docs.

Dart's --obfuscate option is required to be paired with --split-debug-info to generate a symbol map, See docs.

The --split-debug-info option requires setting a output directory, the directory must be an inner folder of the project's folder, See docs.

Flutter's build web command requires setting the --source-maps parameter to generate source maps, See Issue

If a previous release could not be found in the git history, please make sure you set ignore_missing: true in the configuration if you want to ignore such errors, See Issue

24
likes
150
pub points
96%
popularity

Publisher

verified publishersentry.io

A Dart Build Plugin that uploads symbols for Android, iOS/macOS, and Web to Sentry via sentry-cli.

Homepage
Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

MIT (license)

Dependencies

ansicolor, convert, crypto, file, http, injector, process, properties, system_info2, yaml

More

Packages that depend on sentry_dart_plugin