Skip to content
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

Shows connection when there is not connection #9

Open
jorcele opened this issue May 26, 2020 · 2 comments
Open

Shows connection when there is not connection #9

jorcele opened this issue May 26, 2020 · 2 comments

Comments

@jorcele
Copy link

jorcele commented May 26, 2020

If mobile data is on, and the data has gone. The plugin shows that there is internet connectivity.

@gogori2
Copy link

gogori2 commented Jun 4, 2020

I am lurking for this problem/solution all over internet and I hoped this package handles this. If you are correct, it is issue.

@jorcele
Copy link
Author

jorcele commented Jun 5, 2020

I found this solution.
bool hasConnection;
try {
await Firestore.instance.runTransaction((Transaction tx) {}).timeout(
Duration(seconds: 5));
hasConnection = true;
} on PlatformException catch() { // May be thrown on Airplane mode
hasConnection = false;
} on TimeoutException catch(
) {
hasConnection = false;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants