Reputation: 751
I am trying to upload some multimedia files(Images, Audio and Videos) to my server and I only want to upload these files if there is a stable internet connection. Is there a concrete way to achieve this?
Upvotes: 13
Views: 14885
Reputation: 7889
You can use dart's connectivity_plus package which is maintained by Google team, according to its documentation :
"This plugin allows Flutter apps to discover network connectivity and configure themselves accordingly. It can distinguish between cellular vs WiFi connection. This plugin works for iOS and Android."
This way you can use the plugin to determine whether the user is connected over Wifi and if so upload the data, otherwise not to upload and wait for connection type change.
Upvotes: -1
Reputation: 654
One year after, there is a new (Mar. 31, 2020) package that solves this need. Check at https://pub.dev/packages/internet_speed_test#-readme-tab-
Upvotes: 2
Reputation: 1069
there no way to check that currently . but You can try to upload or download a file and calculate the time it took
Upvotes: 1