Skip to content

Commit 1ba8eba

Browse files
authored
flutter(user-feedback): document lastEventId (#9677)
* Add lastEventId to user feedback * Update
1 parent 6ef34f3 commit 1ba8eba

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

docs/platforms/dart/user-feedback/index.mdx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ When a user experiences an error, Sentry provides the ability to collect additio
1010

1111
The user feedback API allows you to collect user feedback while utilizing your own UI. You can use the same programming language you have in your app to send user feedback. In this case, the SDK creates the HTTP request so you don't have to deal with posting data via HTTP.
1212

13-
Sentry pairs the feedback with the original event, giving you additional insight into issues. Sentry needs the `eventId` to be able to associate the user feedback to the corresponding event. For example, to get the `eventId`, you can use <PlatformLink to="/configuration/options/#before-send"><PlatformIdentifier name="before-send" /></PlatformLink> or the return value of the method capturing an event.
13+
Sentry pairs the feedback with the original event, giving you additional insight into issues. Sentry needs the `eventId` to be able to associate the user feedback to the corresponding event. There are several ways to get the `eventId`:
14+
- use {<PlatformLink to="/configuration/options/#before-send"><PlatformIdentifier name="before-send" /></PlatformLink>}
15+
- use the return value of any method capturing an event.
16+
- use `Sentry.lastEventId` to get the ID of the last event sent.
1417

1518
<PlatformContent includePath="user-feedback/sdk-api-example/" />
1619

docs/platforms/flutter/user-feedback/index.mdx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ When a user experiences an error, Sentry provides the ability to collect additio
1010

1111
The user feedback API allows you to collect user feedback while utilizing your own UI. You can use the same programming language you have in your app to send user feedback. In this case, the SDK creates the HTTP request so you don't have to deal with posting data via HTTP.
1212

13-
Sentry pairs the feedback with the original event, giving you additional insight into issues. Sentry needs the `eventId` to be able to associate the user feedback to the corresponding event. For example, to get the `eventId`, you can use <PlatformLink to="/configuration/options/#before-send"><PlatformIdentifier name="before-send" /></PlatformLink> or the return value of the method capturing an event.
13+
Sentry pairs the feedback with the original event, giving you additional insight into issues. Sentry needs the `eventId` to be able to associate the user feedback to the corresponding event. There are several ways to get the `eventId`:
14+
- use {<PlatformLink to="/configuration/options/#before-send"><PlatformIdentifier name="before-send" /></PlatformLink>}
15+
- use the return value of any method capturing an event.
16+
- use `Sentry.lastEventId` to get the ID of the last event sent.
1417

1518
<PlatformContent includePath="user-feedback/sdk-api-example/" />
1619

platform-includes/user-feedback/sdk-api-example/dart.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
11
```dart
22
import 'package:sentry/sentry.dart';
33
4+
// Option 1: Retrieving SentryId from beforeSend
5+
SentryId sentryId = SentryId.empty();
6+
7+
await Sentry.init((options) {
8+
options.beforeSend = (event, {hint}) async {
9+
sentryId = event.eventId;
10+
return event;
11+
};
12+
});
13+
14+
// Option 2: Retrieving SentryId from the method capturing the event
415
SentryId sentryId = Sentry.captureMessage("My message");
516
17+
// Option 3: Retrieving SentryId from the beforeSend callback
18+
SentryId sentryId = Sentry.lastEventId;
19+
620
final userFeedback = SentryUserFeedback(
721
eventId: sentryId,
822
comments: 'Hello World!',

0 commit comments

Comments
 (0)