https://github.com/mainawycliffe/flutter_connectivity_demo
This a simple demos for using the Connectivity Plugin Demo.
https://github.com/mainawycliffe/flutter_connectivity_demo
connectivity flutter flutter-plugins
Last synced: 4 months ago
JSON representation
This a simple demos for using the Connectivity Plugin Demo.
- Host: GitHub
- URL: https://github.com/mainawycliffe/flutter_connectivity_demo
- Owner: mainawycliffe
- Created: 2019-05-30T20:32:58.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-05-30T20:33:41.000Z (over 6 years ago)
- Last Synced: 2025-02-25T05:16:37.048Z (10 months ago)
- Topics: connectivity, flutter, flutter-plugins
- Language: Dart
- Homepage:
- Size: 25 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Flutter Demo - Connectivity Plugin Demo

This a simple demos for using the [Connectivity Plugin Demo](https://pub.dev/packages/connectivity).
The demos taps into the `Stream` provided the plugin and rebuilding the widget using the `StreamBuilder` everytime the connectivity status changes.
```dart
final Stream subscription = Connectivity().onConnectivityChanged;
```
And then:
```dart
StreamBuilder(
stream: subscription,
builder: (BuildContext context, AsyncSnapshot snapshot) {
switch (snapshot.data) {
case ConnectivityResult.mobile:
// connection on mobile
break;
case ConnectivityResult.wifi:
// connection on wifi
break;
default:
// no network connection
}
},
)
```
Please note the following:
> "NB: Note that on Android, this does not guarantee connection to Internet. For instance, the app might have wifi access but it might be a VPN or a hotel WiFi with no access."