flutter_network_connectivity 0.0.3
flutter_network_connectivity: ^0.0.3 copied to clipboard
A Flutter Plugin to check for network status. Plugin uses NetworkCapabilities for Android and NetworkMonitor for iOS.
Flutter Network Connectivity #
A Flutter Plugin to check network status.
Usage #
First, add flutter_network_connectivity
as a dependency in your pubspec.yaml file.
dependencies:
flutter_network_connectivity: ^0.0.3
Don't forget to flutter pub get
.
Then import:
import 'package:flutter_network_connectivity/flutter_network_connectivity.dart';
Now you can create FlutterNetworkConnectivity object and use its methods
FlutterNetworkConnectivity flutterNetworkConnectivity =
FlutterNetworkConnectivity();
Check for current network status:
bool isNetworkConnected =
await flutterNetworkConnectivity.isNetworkAvailable();
Examples #
Simple usage example can be found in the example folder.
Android Uses permission
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
iOS Uses NetworkMonitor, minimum required version 12.0
About #
This plugin uses NetworkCapabilities for Android and NetworkMonitor for iOS.
Todo #
There are few things left to implement:
- Stream of Network Changes (currently working on..)
- Web Implementation
Contributing? #
You're always welcome. See Contributing Guidelines. You can also take a look at Status Tracker to know more information about current or pending features/issues.