-
-
Notifications
You must be signed in to change notification settings - Fork 662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added proper error handling on getResult of location settings #1557
base: main
Are you sure you want to change the base?
Conversation
hi @TimHoogstrate requesting to review this PR, related to your PR as well with added handling: #1367 Asking for help also in the checks, since it fails on main.dart file even though I didn't updated any flutter related files. This should be fix or to be updated on a separate PR. |
Just my two cents. It looks pretty good to me although I'm curious if a failure can hit both the failure listener as well as the completion one? I haven't had a chance to try the branch out yet, but your results sound promising. FYI, we found the same issue where it was returning a result more than once. Definitely one of the big issues. |
Hi @greg-tekai-com, I tried these scenarios:
All of these cases passed and I haven't encountered any errors, crashes or anything related to calling both complete and failure listener. |
Hey there, any idea when this pull might be merged in? |
Resolves #1366 by adding try catch in
getResult
ofcheckLocationSettings
to prevent crash when encounteringRuntimeExecutionException
when one of these errors happened:This also includes the changes from #1367 which is a nice addition for a failure listener as well.
Replication steps:
Given the error above which caused by connection issues, this doesn't have any direct replication steps. However, since we have logs in our Firebase Crashlytics, I tried simulating the error the check the behavior (by forcing throwing an error) and the app is actually crashing.
To forcefully replicate the error, simply throw an exception (in the
response.getResult
):Here's the sample screenshot of one of our crash logs:
Sample handling on Flutter side:
Since the app will not crash anymore and is properly returning an error, we can now handle it on the Flutter side. One example is to simply wrap it in a try catch, and do what the app should do when
isLocationServiceEnabled
fails (retry, show proper error dialog, etc):Pre-launch Checklist
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is does not need version changes.CHANGELOG.md
to add a description of the change.///
).main
.dart format .
and committed any changes.flutter analyze
and fixed any errors.