I have been looking for a way to detect if my Flutter App has access to the internet. I want to use this to let the app make a choice of either sending some data to an API, if there is internet, or saving it to a local database, if there is no internet.
I have tried some of the plugins but all of them seem to detect the network state rather then checking if there is an internet connection.
I have tried just simply sending a ping and checking it that way but when I do that it seems to take a really long time to stop and return the ping failure.
I am also using the DIO library to access the API so I also have tried detecting it through that library but it also takes quite some time to stop and return (around 30 seconds). In this case I think I just hit a timeout but that also isn't really what I am looking for.
Any ideas or better methods of detecting if there is an active internet connection in a rather quick way and not the network state?