Im new in Flutter Framework and unable to find any replacement library for internet availability like we have Reachability in iOS. any help will be appreciated. Thanks.


Solution 1: shakil.k

you can use the following plugin to check connectivity

https://github.com/flutter/plugins/tree/master/packages/connectivity

 import 'package:connectivity/connectivity.dart';

  var connectivityResult = await (new 
  Connectivity().checkConnectivity());
if (connectivityResult == ConnectivityResult.mobile) {
  // I am connected to a mobile network.
  }.  else if (connectivityResult == ConnectivityResult.wifi) 
{
   // I am connected to a wifi network.
 }


Solution 2: Shyju M

You can use connectivity plugin. This plugin works for iOS and Android.

Sample usage to check current status:

import 'package:connectivity/connectivity.dart';

    var connectivityResult = await (new Connectivity().checkConnectivity());
    if (connectivityResult == ConnectivityResult.mobile) {
      // I am connected to a mobile network.
    } else if (connectivityResult == ConnectivityResult.wifi) {
      // I am connected to a wifi network.
    }


Solution 3: creativecreatorormaybenot

You can build reactive layouts using a StreamBuilder and the connectivity plugin:

StreamBuilder(
  stream: Connectivity().onConnectivityChanged,
  builder: (BuildContext context, AsyncSnapshot<ConnectivityResult> result) {
    if (result.data == ConnectivityResult.wifi)
      return Text('wifi');
    return Text('no wifi');
  }
)