Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:async';

import 'package:flutter/foundation.dart';
import 'package:sentry/sentry.dart';
import '../sentry_flutter_options.dart';
Expand All @@ -22,7 +24,7 @@ class FlutterErrorIntegration implements Integration<SentryFlutterOptions> {
@override
void call(Hub hub, SentryFlutterOptions options) {
_defaultOnError = FlutterError.onError;
_integrationOnError = (FlutterErrorDetails errorDetails) async {
_integrationOnError = (FlutterErrorDetails errorDetails) {
final exception = errorDetails.exception;

options.log(
Expand Down Expand Up @@ -88,7 +90,7 @@ class FlutterErrorIntegration implements Integration<SentryFlutterOptions> {
stackTrace = getCurrentStackTrace();
hint.addAll({TypeCheckHint.currentStackTrace: true});
}
await hub.captureEvent(event, stackTrace: stackTrace, hint: hint);
unawaited(hub.captureEvent(event, stackTrace: stackTrace, hint: hint));
// we don't call Zone.current.handleUncaughtError because we'd like
// to set a specific mechanism for FlutterError.onError.
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:async';

import 'package:sentry/sentry.dart';
// ignore: implementation_imports
import 'package:sentry/src/utils/stacktrace_utils.dart';
Expand Down Expand Up @@ -83,8 +85,7 @@ class OnErrorIntegration implements Integration<SentryFlutterOptions> {
stackTrace = getCurrentStackTrace();
hint = Hint.withMap({TypeCheckHint.currentStackTrace: true});
}
// unawaited future
hub.captureEvent(event, stackTrace: stackTrace, hint: hint);
unawaited(hub.captureEvent(event, stackTrace: stackTrace, hint: hint));

return handled;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ void main() {
_mockValues();

// replace default error otherwise it fails on testing
FlutterError.onError =
handler ?? (FlutterErrorDetails errorDetails) async {};
FlutterError.onError = handler ?? (FlutterErrorDetails errorDetails) {};

final sut = fixture.getSut();
sut(fixture.hub, fixture.options);
Expand Down Expand Up @@ -169,7 +168,7 @@ void main() {
_mockValues();

var numberOfDefaultCalls = 0;
final defaultError = (FlutterErrorDetails errorDetails) async {
final defaultError = (FlutterErrorDetails errorDetails) {
numberOfDefaultCalls++;
};
FlutterError.onError = defaultError;
Expand Down
Loading