startInternetSubscription static method
void
startInternetSubscription(
- void disconnectDialog()
Implementation
static void startInternetSubscription(void Function() disconnectDialog) {
final connectionChecker = InternetConnectionChecker();
final subscription = connectionChecker.onStatusChange.listen(
(InternetConnectionStatus status) {
if (status == InternetConnectionStatus.connected) {
LoggerService.logInfo('Connected to the internet');
} else {
LoggerService.logInfo('Disconnect to the internet');
disconnectDialog();
}
},
);
getIt.registerSingleton<StreamSubscription<InternetConnectionStatus>>(subscription);
}