observe_internet_connectivity
library
Classes
-
DefaultObServingStrategy
-
This is the strategy used if you don't supply any strategy to the InternetConnectivity class,
you will have to cancel the subscription manually.
-
DisposeAfterDurationStrategy
-
This strategy set the duration to listen for the internet connection events,
the subscription will be closed once the duration elapses
-
DisposeOnFirstConnectedStrategy
-
This strategy cancel the subscription automatically after the first connected event,
i.e once the device has internet connection, the stream subscription will be automatically closed.
-
DisposeOnFirstDisconnectedStrategy
-
This strategy cancel the subscription automatically after the first disconnected event,
i.e once the device is offline, the stream subscription will be automatically closed.
-
InternetAddress
-
-
InternetConnectivity
-
The InternetConnectivity class is responsible for observing the internet connectivity using the InternetObservingStrategy and a StreamController to emit internet connection changes.
If no strategy is supplied when creating InternetConnectivity, the DefaultObServingStrategy will be used.
-
InternetConnectivityBuilder
-
Use InternetConnectivityBuilder to build internet connection aware widgets.
InternetConnectivityBuilder use StreamBuilder under the hood
return InternetConnectivityBuilder(
connectivityBuilder: (BuildContext context, bool hasInternetAccess, Widget? child) {
if(hasInternetAccess) {
return OnlineWidget();
} else {
return OfflineWidget();
}
},
child: ChildWidget(),
);
-
InternetConnectivityListener
-
Use InternetConnectivityListener to listen to internet connectivity changes inside a flutter widget
-
InternetObservingStrategy
-
The base for all Observing strategies. If you'd like to create a new Strategy, extend from this class.
check SocketObservingStrategy for strategy that opens a socket to a list of specified addresses
-
SocketObservingStrategy
-
The base for all Observing strategies for strategy that opens a socket to a list of specified addresses.