Skip to content

Commit 052a368

Browse files
authored
Make hint non-nullable in BeforeSendCallback, BeforeBreadcrumbCall and EventProcessor (#1574)
1 parent c59de47 commit 052a368

File tree

47 files changed

+279
-234
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+279
-234
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
- Older self-hosted sentry instances will drop transactions containing unfinished spans.
1111
- This change was introduced in [relay/#1690](https://github.com/getsentry/relay/pull/1690) and released with [22.12.0](https://github.com/getsentry/relay/releases/tag/22.12.0)
1212
- Do not leak extensions of external classes ([#1576](https://github.com/getsentry/sentry-dart/pull/1576))
13-
13+
- Make `hint` non-nullable in `BeforeSendCallback`, `BeforeBreadcrumbCall` and `EventProcessor` ([#1574](https://github.com/getsentry/sentry-dart/pull/1574))
14+
- This will affect your callbacks, making this a breaking change.
15+
1416
## Unreleased
1517

1618
### Fixes

dart/example/bin/example.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Future<void> decode() async {
104104

105105
class TagEventProcessor implements EventProcessor {
106106
@override
107-
SentryEvent? apply(SentryEvent event, {hint}) {
107+
SentryEvent? apply(SentryEvent event, hint) {
108108
return event..tags?.addAll({'page-locale': 'en-us'});
109109
}
110110
}

dart/example_web/web/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ Future<void> parseData() async {
129129

130130
class TagEventProcessor implements EventProcessor {
131131
@override
132-
SentryEvent? apply(SentryEvent event, {hint}) {
132+
SentryEvent? apply(SentryEvent event, Hint hint) {
133133
return event..tags?.addAll({'page-locale': 'en-us'});
134134
}
135135
}

dart/lib/src/event_processor.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import 'protocol.dart';
88
/// null in case the event will be dropped and not sent.
99
abstract class EventProcessor {
1010
FutureOr<SentryEvent?> apply(
11-
SentryEvent event, {
12-
Hint? hint,
13-
});
11+
SentryEvent event,
12+
Hint hint,
13+
);
1414
}

dart/lib/src/event_processor/deduplication_event_processor.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class DeduplicationEventProcessor implements EventProcessor {
2626
final SentryOptions _options;
2727

2828
@override
29-
SentryEvent? apply(SentryEvent event, {Hint? hint}) {
29+
SentryEvent? apply(SentryEvent event, Hint hint) {
3030
if (event is SentryTransaction) {
3131
return event;
3232
}

dart/lib/src/event_processor/enricher/io_enricher_event_processor.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class IoEnricherEventProcessor implements EnricherEventProcessor {
1818
final SentryOptions _options;
1919

2020
@override
21-
SentryEvent? apply(SentryEvent event, {Hint? hint}) {
21+
SentryEvent? apply(SentryEvent event, Hint hint) {
2222
// If there's a native integration available, it probably has better
2323
// information available than Flutter.
2424

dart/lib/src/event_processor/enricher/web_enricher_event_processor.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class WebEnricherEventProcessor implements EnricherEventProcessor {
2121
final SentryOptions _options;
2222

2323
@override
24-
SentryEvent? apply(SentryEvent event, {Hint? hint}) {
24+
SentryEvent? apply(SentryEvent event, Hint hint) {
2525
// Web has no native integration, so no need to check for it
2626

2727
final contexts = event.contexts.copyWith(

dart/lib/src/event_processor/exception/io_exception_event_processor.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class IoExceptionEventProcessor implements ExceptionEventProcessor {
1414
final SentryOptions _options;
1515

1616
@override
17-
SentryEvent? apply(SentryEvent event, {Hint? hint}) {
17+
SentryEvent? apply(SentryEvent event, Hint hint) {
1818
final throwable = event.throwable;
1919
if (throwable is HttpException) {
2020
return _applyHttpException(throwable, event);

dart/lib/src/event_processor/exception/web_exception_event_processor.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ ExceptionEventProcessor exceptionEventProcessor(SentryOptions _) =>
88

99
class WebExcptionEventProcessor implements ExceptionEventProcessor {
1010
@override
11-
SentryEvent apply(SentryEvent event, {Hint? hint}) => event;
11+
SentryEvent apply(SentryEvent event, Hint hint) => event;
1212
}

dart/lib/src/hint.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import 'sentry_attachment/sentry_attachment.dart';
1111
/// Example:
1212
///
1313
/// ```dart
14-
/// options.beforeSend = (event, {hint}) {
15-
/// final syntheticException = hint?.get(TypeCheckHint.syntheticException);
14+
/// options.beforeSend = (event, hint) {
15+
/// final syntheticException = hint.get(TypeCheckHint.syntheticException);
1616
/// if (syntheticException is FlutterErrorDetails) {
1717
/// // Do something with hint data
1818
/// }
@@ -28,14 +28,14 @@ import 'sentry_attachment/sentry_attachment.dart';
2828
/// ```dart
2929
/// import 'dart:convert';
3030
///
31-
/// options.beforeSend = (event, {hint}) {
31+
/// options.beforeSend = (event, hint) {
3232
/// final text = 'This event should not be sent happen in prod. Investigate.';
3333
/// final textAttachment = SentryAttachment.fromIntList(
3434
/// utf8.encode(text),
3535
/// 'event_info.txt',
3636
/// contentType: 'text/plain',
3737
/// );
38-
/// hint?.attachments.add(textAttachment);
38+
/// hint.attachments.add(textAttachment);
3939
/// return event;
4040
/// };
4141
/// ```

0 commit comments

Comments
 (0)