Skip to content

Commit 4af0a11

Browse files
Update Crash Reporting to use null-aware operators
1 parent e7bd9ef commit 4af0a11

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

lib/CrashReporting.dart

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@ class CrashReporting {
3838
/// [StackTrace] stack
3939
static Future<void> reportHandledCrash(dynamic exception,
4040
[StackTrace? stack]) async {
41-
if (stack != null) {
42-
_sendCrash(exception, stack, true);
43-
} else {
44-
_sendCrash(exception, StackTrace.current, true);
45-
}
41+
_sendCrash(exception, stack ?? StackTrace.current, true);
4642
}
4743

4844
static Future<void> _reportUnhandledCrash(
@@ -59,7 +55,7 @@ class CrashReporting {
5955
trace.frames[i].uri.toString(),
6056
trace.frames[i].member,
6157
trace.frames[i].line,
62-
trace.frames[i].column == null ? 0 : trace.frames[i].column!));
58+
trace.frames[i].column ?? 0));
6359
}
6460
final CrashData crashData = CrashData(
6561
exception.toString(), Platform.operatingSystem.toString(), frames);

0 commit comments

Comments
 (0)