Skip to content

Commit

Permalink
feat(crashlytics): add new error record
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-the-shark committed Sep 24, 2024
1 parent bbc2547 commit 92d1dd5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions lib/widgets/my_error_widget.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import "package:firebase_crashlytics/firebase_crashlytics.dart";
import "package:flutter/material.dart";
import "package:flutter_hooks/flutter_hooks.dart";
import "package:logger/logger.dart";
import "package:lottie/lottie.dart";

Expand All @@ -18,6 +20,15 @@ class MyErrorWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
Logger().e(error.toString());
useEffect(() {
Future.microtask(
() async =>
FirebaseCrashlytics.instance.recordError(error, StackTrace.current),
);
return null;
}, [
error,
]);
return switch (error) {
ParkingsOfflineException() => const OfflineParkingsView(),
GqlOfflineException(:final ttlKey) => OfflineGraphQLMessage(ttlKey),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 0.14.1+36
version: 0.14.2+37

environment:
sdk: ">=3.3.0 <4.0.0"
Expand Down

0 comments on commit 92d1dd5

Please sign in to comment.