From 8d68ccfc7b0a3a7491d3665da798c9b41c21e4a9 Mon Sep 17 00:00:00 2001
From: OmarHatem <omarh.ismail1@gmail.com>
Date: Mon, 9 Jan 2023 20:03:26 +0200
Subject: [PATCH] Ignore UI issues from exceptions report

---
 lib/main.dart | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/main.dart b/lib/main.dart
index a6594a097..126bd213f 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -57,7 +57,10 @@ Future<void> main() async {
     WidgetsFlutterBinding.ensureInitialized();
 
     FlutterError.onError = (errorDetails) {
-      _onError(errorDetails);
+      // if not a UI error
+      if (errorDetails.library != "widgets library") {
+        _onError(errorDetails);
+      }
     };
 
     /// A callback that is invoked when an unhandled error occurs in the root
@@ -193,8 +196,8 @@ void _sendExceptionFile() async {
 
   final result = await FlutterMailer.send(mailOptions);
 
-  // clear file content if the error was sent or saved
-  // on android we can't know if it was sent or saved
+  // Clear file content if the error was sent or saved.
+  // On android we can't know if it was sent or saved
   if (result.name == MailerResponse.sent.name ||
       result.name == MailerResponse.saved.name ||
       result.name == MailerResponse.android.name) {