easy_localization_loader icon indicating copy to clipboard operation
easy_localization_loader copied to clipboard

update connectivity_plus package to the latest version

Open AlaaEddineCharbib opened this issue 1 year ago • 3 comments

update connectivity_plus package to the latest version to avoid packages dependency resolving issues with other packages that depend on js 0.7.1 (e.g syncfusion_flutter_pdfviewer: ^25.1.39)

AlaaEddineCharbib avatar Apr 11 '24 12:04 AlaaEddineCharbib

@bw-flagship Any chance we could get this merged soon?

FXschwartz avatar May 06 '24 13:05 FXschwartz

@FXschwartz I am fine with the upgrade, but it seems that an analyzer warning was introduced that need to be fixed before merging

bw-flagship avatar May 06 '24 13:05 bw-flagship

@AlaaEddineCharbib I made the necessary change but don't have permission to push to your fork. The analyzer is complaining because Connectivity().checkConnectivity() returns a list of results and on line 69 of smart_network_asset_loader.dart we are doing just an equality check.

The change should be to make it use .contains like below.

  Future<bool> isInternetConnectionAvailable() async {
    final connectivityResult = await Connectivity().checkConnectivity();
    if (connectivityResult.contains(ConnectivityResult.none)) {
      return false;
    } else {
      try {
        final result = await InternetAddress.lookup('google.com');
        if (result.isNotEmpty && result[0].rawAddress.isNotEmpty) {
          return true;
        }
      } on SocketException catch (_) {
        return false;
      }
    }

    return false;
  }

FXschwartz avatar May 06 '24 14:05 FXschwartz