Created
June 13, 2021 15:03
-
-
Save sigmapie8/82721079748e3d445d8b61fe25a1378d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:connectivity_plus/connectivity_plus.dart'; | |
import 'package:flutter/cupertino.dart'; | |
import 'package:flutter/material.dart'; | |
class ConnectionType extends StatefulWidget { | |
@override | |
_ConnectionTypeState createState() => _ConnectionTypeState(); | |
} | |
class _ConnectionTypeState extends State<ConnectionType> { | |
@override | |
Widget build(BuildContext context) { | |
return FutureBuilder( | |
future: Connectivity().checkConnectivity(), | |
builder: (BuildContext context, | |
AsyncSnapshot<ConnectivityResult> connectionType) { | |
if (!connectionType.hasData) { | |
return ListTile( | |
title: CircularProgressIndicator(), | |
); | |
} else { | |
return ListTile( | |
title: Text('${connectionType.data}'), | |
); | |
} | |
}, | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment