i want to listen network connectivity on my whole project this is work perfect but child return alway homePage when connection restored im using #InternetConnectionChecker dependency
GetMaterialApp(
// initialBinding: DataBinding(),
navigatorKey: NavigationService.navigatorKey,
builder: (context , child){
return StreamBuilder<InternetConnectionStatus>(
stream: InternetConnectionChecker().onStatusChange,
builder: (context , snapshot){
final connectivityResult = snapshot.data;
print("result"+connectivityResult.toString());
if(connectivityResult.toString()=="InternetConnectionStatus.disconnected") {
return NoInternet();
}
return child!;
},
);
},
debugShowCheckedModeBanner: false,
theme: Themes.light,
home:HomePage(deviceAddress: ''));
// global context class
class NavigationService {
static GlobalKey<NavigatorState> navigatorKey =
GlobalKey<NavigatorState>();
}
You should use the below written code
The data_connection_checker package is used in it
You can return the statement as you want, like alert message or navigation to ‘No Network’ Screen