Code Monkey home page Code Monkey logo

data_connection_checker's Issues

Null-safety

Will this library be upgraded to null-safety?

Modify testing logic to immediately return if any of the simultaneous pings succeed

Currently the logic is "All addresses are pinged simultaneously. ... When all the requests complete with either success or failure, a check is made to see if the list contains at least one true boolean.". However if any of the hosts slow to respond (for example for some reason CloudFlare DNSes don't respond (#10 (comment)) then we have to wait a timeout (10 seconds). In my opinion if any of the pings succeed then the test could already cut short any other pings and return immediately.

web support

I see the error below when targeting web. Not sure if this is just a limitation of flutter for web at this point or a problem with this library.

errors.dart:145 Uncaught (in promise) Error: Unsupported operation: InternetAddress
    at Object.throw_ [as throw] (errors.dart:191)
    at Function.new (io_patch.dart:408)
    at get DEFAULT_ADDRESSES (data_connection_checker.dart:61)
    at Function.desc.get [as DEFAULT_ADDRESSES] (utils.dart:75)
    at new data_connection_checker.DataConnectionChecker.__ (data_connection_checker.dart:89)
    at get _instance (data_connection_checker.dart:109)
    at Function.desc.get [as _instance] (utils.dart:75)
    at Function.new (data_connection_checker.dart:93)
    at network_info.NetworkInfoImpl.new._checkConnection (network_info.dart:39)
    at _checkConnection.next (<anonymous>)
    at runBody (async_patch.dart:84)
    at Object._async [as async] (async_patch.dart:123)
    at network_info.NetworkInfoImpl.new.[_checkConnection] (network_info.dart:38)
    at new network_info.NetworkInfoImpl.new (network_info.dart:16)
    at main$ (main.dart:62)
    at main$.next (<anonymous>)
    at onValue (async_patch.dart:45)
    at _RootZone.runUnary (zone.dart:1379)
    at _FutureListener.thenAwait.handleValue (future_impl.dart:137)
    at handleValueCallback (future_impl.dart:678)
    at Function._propagateToListeners (future_impl.dart:707)
    at _Future.new.[_completeWithValue] (future_impl.dart:522)
    at future.dart:400
    at _RootZone.runUnary (zone.dart:1379)
    at _FutureListener.then.handleValue (future_impl.dart:137)
    at handleValueCallback (future_impl.dart:678)
    at Function._propagateToListeners (future_impl.dart:707)
    at _Future.new.[_completeWithValue] (future_impl.dart:522)
    at async._AsyncCallbackEntry.new.callback (future_impl.dart:552)
    at Object._microtaskLoop (schedule_microtask.dart:41)
    at _startMicrotaskLoop (schedule_microtask.dart:50)
    at async_patch.dart:166

Also seeing warnings during build:

Skipping compiling my_proj|lib/main_web_entrypoint.dart with ddc because some of its
transitive libraries have sdk dependencies that not supported on this platform:

data_connection_checker|lib/data_connection_checker.dart

Adding custom addresses to check for connection

It would be a great enhancement if you could add a property to add custom addresses instead of the default ones.
example code would be:

DataConnectionChecker(ipAddresses:<ipAddress>[]);

Apple rejected my update due to data connection checker

Hello,
please check the screenshot, it's from my app https://well-spoken.app .

Apple is mysterious in their review process, I haven't changed anything in networking for 20 updates, and now they came up with this when rolling new features.

As you see on the screenshot, they were testing my app on iPad, and there is an additional layer of complexity - VPN, maybe it affects querying DNSes? I saw some other comments, perhaps we should use IPV6? Perhaps if all DNSes fail I should do additional request to my own server to verify the status of the network?

attachment Screenshot-0920-095247

I'm using most recent version of data_connection_checker.

I managed to convenience them to accept it without changes, but I'm afraid it's not a sustainable solution.

can't add the package (Version Failure)

The current Dart SDK version is 3.2.3.
Project depends on data_connection_checker any which doesn't support null safety, version solving failed.
The lower bound of "sdk: '>=2.2.0 <3.0.0'" must be 2.12.0 or higher to enable null safety.

No internet connection even though I have internet connection.

flutter: No internet :( Reason:
flutter: [AddressCheckResult(AddressCheckOptions(InternetAddress('1.1.1.1', IPv4), 53, 0:00:10.000000), false), AddressCheckResult(AddressCheckOptions(InternetAddress('8.8.4.4', IPv4), 53, 0:00:10.000000), false), AddressCheckResult(AddressCheckOptions(InternetAddress('208.67.222.222', IPv4), 53, 0:00:10.000000), false)]

I am using a school wifi connection and data_connection_checker is failing when tries to connect internet. I tried a different wifi (my phone's), it worked.

I am hoping this can be fixed because the app I am developing is focusing on students and they will be at school most of the time :)

SocketException when device is offline

A SocketException is thrown whenever I call the hasConnection method when the device is offline.

class NetworkInfoImpl implements NetworkInfo{
  final DataConnectionChecker connectionChecker;

  NetworkInfoImpl(this.connectionChecker);
  @override

  Future<bool> get isConnected => connectionChecker.hasConnection;

}

SocketException (SocketException: Connection failed (OS Error: Network is unreachable, errno = 101), address = 1.1.1.1, port = 53)
SocketException (SocketException: Connection failed (OS Error: Network is unreachable, errno = 101), address = 8.8.4.4, port = 53)
SocketException (SocketException: Connection failed (OS Error: Network is unreachable, errno = 101), address = 208.67.222.222, port = 53)

Don't use it on production for iOS!

In current version it will never pass Apple AppStore app approval process, because it does not work in IPv6 network. I wasted few days because of it.

Add network check

The connectivity package does not support native dart.

Can you add the option to check if the device have network? (internet DataConnectionChecker will stay the same).

It will be very helpful to have something like DataConnectionChecker().onStatusChange.listen( but for the network connection only.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.