Skip to content

Commit 75b5f42

Browse files
committed
Adjust snippet
1 parent 1374307 commit 75b5f42

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

platform-includes/enriching-events/attach-screenshots/dart.flutter.mdx

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ await SentryFlutter.init(
1515

1616
## Customize Screenshot Capturing
1717

18-
By default, Flutter limits screenshot captures to once every 2 seconds to minimize performance impact. While this debounce interval cannot be changed, you can customize capture behavior by implementing the `beforeCaptureScreenshot` callback in your `SentryFlutterOptions`.
18+
By default, Flutter limits screenshot captures to once every 2 seconds to minimize performance impact. While this debounce interval cannot be changed, you can customize capture behavior by implementing the `beforeCaptureScreenshot` callback in `SentryFlutter.init`.
1919

2020
This callback gives you fine-grained control over screenshot captures based on event and hint data, allowing you to implement conditional logic.
2121

@@ -28,26 +28,22 @@ If you want to capture screenshots regardless of the debounce, you can ignore th
2828

2929
</Alert>
3030

31-
```dart {tabTitle: 'Respect debounce'} {2-9}
32-
await SentryFlutter.init((options) {
33-
options.beforeCaptureScreenshot = (event, hint, shouldDebounce) async {
34-
// If shouldDebounce is active, skip capturing
35-
if (shouldDebounce) {
36-
return false;
37-
}
38-
// Capture screenshot if it's a fatal event
39-
return event.level == SentryLevel.fatal;
40-
};
41-
});
31+
```dart {tabTitle: Respect debounce}
32+
options.beforeCaptureScreenshot = (event, hint, shouldDebounce) async {
33+
// If shouldDebounce is active, skip capturing
34+
if (shouldDebounce) {
35+
return false;
36+
}
37+
// Capture screenshot if it's a fatal event
38+
return event.level == SentryLevel.fatal;
39+
};
4240
```
4341

44-
```dart {tabTitle: 'Ignore debounce'} {2-4}
45-
await SentryFlutter.init((options) {
46-
options.beforeCaptureScreenshot = (event, hint, shouldDebounce) async {
47-
// Capture screenshot if it's a fatal event regardless of debounce
48-
return event.level == SentryLevel.fatal;
49-
};
50-
});
42+
```dart {tabTitle: Ignore debounce}
43+
options.beforeCaptureScreenshot = (event, hint, shouldDebounce) async {
44+
// Capture screenshot if it's a fatal event regardless of debounce
45+
return event.level == SentryLevel.fatal;
46+
};
5147
```
5248

5349
## Redact Screenshots via `masking`

0 commit comments

Comments
 (0)