sendToSentryWithException function
OnFeedbackCallback
sendToSentryWithException({
- Hub? hub,
- String? name,
- String? email,
- Object? exception,
- StackTrace? stackTrace,
See SentryFeedback.showAndUploadToSentryWithException. This is just visibleForTesting.
Implementation
@visibleForTesting
OnFeedbackCallback sendToSentryWithException({
Hub? hub,
String? name,
String? email,
Object? exception,
StackTrace? stackTrace,
}) {
final realHub = hub ?? HubAdapter();
return (UserFeedback feedback) async {
final id = await realHub.captureException(
exception,
stackTrace: stackTrace,
withScope: (scope) {
scope.addAttachment(SentryAttachment.fromUint8List(
feedback.screenshot,
'screenshot.png',
contentType: 'image/png',
));
},
);
await realHub.captureUserFeedback(SentryUserFeedback(
eventId: id,
email: email,
name: name,
comments: feedback.text + '\n${feedback.extra.toString()}',
));
};
}