Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions platform-includes/enriching-events/attach-screenshots/flutter.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,33 @@ Future<void> main() async {
);
}
```

### Filtering Screenshots

You can filter your screenshots by using the `beforeScreenshot` callback.
It is called before taking a screenshot and if the callback returns `false`, the screenshot will not be attached.

```dart
import 'package:flutter/widgets.dart';
import 'package:sentry_flutter/sentry_flutter.dart';

Future<void> main() async {
await SentryFlutter.init(
(options) {
options.dsn = '___PUBLIC_DSN___';
options.attachScreenshot = true;
options.beforeScreenshot = (event, {hint}) {
// Return false if you don't want to attach the screenshot based on some condition.
return true;
};
},
appRunner: () => runApp(
// Wrap your app widget with the [SentryWidget] widget.
SentryWidget(
child: MyApp(),
),
),
);
}
```