Skip to content

Dart: Document Scope Deprecations #5145

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
### Scope Synchronization

Starting with version `6.6.0` of the SDK, setting data on the Flutter `Scope` can be synced to the Android and iOS SDKs. This behavior is enabled by default and can be disabled by setting `SentryOptions.enableScopeSync` to false. The following `Scope` methods will sync and can also be awaited upon:
- `setContexts`
- `removeContexts`
- `setUser`
- `addBreadcrumb`
- `clearBreadcrumbs`
- `setExtra`
- `removeExtra`
- `setTag`
- `removeTag`
8 changes: 7 additions & 1 deletion src/platforms/common/configuration/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ If the callback is not set, or it returns `undefined`, the default naming scheme
<ConfigKey name="enabled" supported={["javascript", "node"]}>

Specifies whether this SDK should send events to Sentry. Defaults to `true`. Setting this to `enabled: false` doesn't prevent all overhead from Sentry instrumentation. To disable Sentry completely, depending on environment, call `Sentry.init` conditionally.

</ConfigKey>

<ConfigKey name="send-client-reports" supported={["java", "javascript", "dotnet", "python", "dart", "apple"]} notSupported={["react-native"]}>
Expand Down Expand Up @@ -660,4 +660,10 @@ Set this callback, which is called after the Sentry React Native SDK initializes

</ConfigKey>

<ConfigKey name="enableScopeSync" supported={["flutter"]}>

Set this boolean to `false` to disable sync of `Scope` data to Android and iOS SDKs.

</ConfigKey>

</PlatformSection>
2 changes: 1 addition & 1 deletion src/platforms/common/enriching-events/scopes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ You can also apply this configuration when unsetting a user at logout:

</PlatformSection>

<PlatformSection supported={["android"]}>
<PlatformSection supported={["android", "flutter"]}>

<PlatformContent includePath="enriching-events/scopes/scope-synchronization" />

Expand Down
15 changes: 15 additions & 0 deletions src/platforms/dart/migration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ Future<void> main() async {
}
```

- The `Scope.user` setter was deprecated in favor of `Scope.setUser`, and it will be removed in a future update.

- The `Scope.attachements` getter was deprecated in favor of `attachments`, and it will be removed in a future update.

- The following `Scope` methods now return `Future<void>` instead of `void`:
- `setContexts`
- `removeContexts`
- `setUser`
- `addBreadcrumb`
- `clearBreadcrumbs`
- `setExtra`
- `removeExtra`
- `setTag`
- `removeTag`

### Sentry Self-hosted Compatibility

- Starting with version `6.6.0` of `sentry`, [Sentry's version >= v21.9.0](https://github.com/getsentry/self-hosted/releases) is required or you have to manually disable sending client reports via the `sendClientReports` option. This only applies to self-hosted Sentry. If you are using [sentry.io](https://sentry.io), no action is needed.
Expand Down