-
Notifications
You must be signed in to change notification settings - Fork 4k
🐛 [cloud_firestore] does not throw exception when the phone is without connection or internet #7636
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
Comments
@darshankawar, the answer on this link of stackoverflow has some problems. In one of them, when it did "if (snapshot.empty && snapshot.metadata.fromCache)", the problem is if the list is really empty on the base. Another problem is checking the connection before every access, if the internet is online when I check and in the next moment (access to the firebase) the internet fall, in this case, we return to the original problem. |
@darshankawar the ideal is to have a global option to say whether to throw an exception or not, so that it can be handled by the API user and give feedback to the user of app, so that the user doesn't see just a void list @GMChristo I totally agree, checking if you have internet every time you run an operation on the database is an overload, in addition to causing greater latency in displaying the data. |
Thanks for your input. Leaving this issue open and labeling it for further insights from the team. Related SO link I shared earlier: https://stackoverflow.com/questions/63414747/how-to-catch-client-is-offline-error-in-flutter-firebase-firestore/63415042#63415042 Similar / related issue: #6749 |
Hey folks, Firestore & Database do not throw errors when the users phone is offline by design. They are awaiting (in the hope) that they do come back online and sync up what is local with the remote database. If you would like to change this behaviour, you ought to raise it in the android or iOS SDK repo, but I can't imagine they will change something that is fundamental to Firestore's function. FlutterFire is just a wrapper around both iOS and android SDKs. |
cloud_firestore does not throw exception when the phone is without connection or internet, it puts everything in the log but it does not propagate the exception, it should throw an exception to be treated with a message to give feedback to the user.
pubspec.yaml
log
The text was updated successfully, but these errors were encountered: